Sudo/ru: Difference between revisions
Appearance
Created page with "Sudo" |
Updating to match new version of source page Tags: Mobile edit Mobile web edit |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
[https://www.sudo.ws Sudo] allows a system | [https://www.sudo.ws Sudo] allows a system | ||
administrator to delegate authority to give certain users - or groups of users - the ability to run commands as root or another user while providing an audit trail of the commands and their arguments. | administrator to delegate authority to give certain [[User management|users]] - or groups of users - the ability to run commands as root or another user while providing an audit trail of the commands and their arguments. | ||
</div> | </div> | ||
< | <div class="mw-translate-fuzzy"> | ||
== Использование == | == Использование == | ||
</div> | </div> | ||
Следующая простая настройка позволит всем пользователям, входящим в группу <code>wheel</code>, выполнять команды, указанные в <code>extraRules</code>, от имени суперпользователя с помощью <codd>sudo</code> без необходимости вводить пароль пользователя. | |||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
security.sudo = { | security.sudo = { |
Latest revision as of 20:55, 7 October 2025
Sudo allows a system administrator to delegate authority to give certain users - or groups of users - the ability to run commands as root or another user while providing an audit trail of the commands and their arguments.
Использование
Следующая простая настройка позволит всем пользователям, входящим в группу wheel
, выполнять команды, указанные в extraRules
, от имени суперпользователя с помощью <codd>sudo без необходимости вводить пароль пользователя.
security.sudo = {
enable = true;
extraRules = [{
commands = [
{
command = "${pkgs.systemd}/bin/systemctl suspend";
options = [ "NOPASSWD" ];
}
{
command = "${pkgs.systemd}/bin/reboot";
options = [ "NOPASSWD" ];
}
{
command = "${pkgs.systemd}/bin/poweroff";
options = [ "NOPASSWD" ];
}
];
groups = [ "wheel" ];
}];
extraConfig = with pkgs; ''
Defaults:picloud secure_path="${lib.makeBinPath [
systemd
]}:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin"
'';
};