我想添加一个能够执行的用户 “添加用户” 和 “更改密码” 命令。我在visudo中添加了一些我在Stack Exchange回答中找到的配置,但它不起作用。
这是我的 /etc/sudoers
文件:
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
Cmnd_Alias USER_COMMANDS = /usr/sbin/adduser, /usr/sbin/chpasswd
# User privilege specification
root ALL=(ALL:ALL) ALL
sano ALL=(ALL) NOPASSWD: USER_COMMANDS
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
有人知道为什么吗?无论如何它还是要我输入密码或者我得到了:
adduser:只有root可以将用户或组添加到系统中。