我想授予一个组安装软件的权限,而无需输入 root/sudo 密码。我在 Linux Mint 20.3 Cinnamon 上。
我创建了一个名为“basicsudo”的组。
我先打字
$ which apt-get
/usr/bin/apt-get
然后
sudo visudo
然后我添加了以下行
%basicsudo ALL=(ALL) NOPASSWD: /usr/bin/apt-get install
到/etc/sudoers.tmp
[...]
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
%basicsudo ALL=(ALL) NOPASSWD: /usr/bin/apt-get install
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
Groups and Users
我使用菜单中的 GUI将组分配给用户。为了检查这个我跑了
$ groupname Alice
Alice, basicsudo
从我的帐户。
当以 Alice 身份登录时,这是确认的
$ groups
Alice, basicsudo
但是当尝试以爱丽丝身份执行以下行时,我没有成功:
$ sudo apt-get install python3-pip
[sudo] password for Alice:
Sorry, user Alice is not allowed to execute '/usr/bin/apt-get install python3-pip' as root on computername.
很明显 a) 系统提示我输入密码 b) 尽管输入了密码但我无法执行它。
这样做的正确方法是什么?
groupname
组中的?您究竟在哪里添加了“我将组分配给用户”下显示的行。groups
当您以 Alice 身份登录时的输出是什么?groupname Alice
@terdon 输出与我的 root 帐户相同。