sudo group和sudoers文件之间的区别?


1

我正在使用命令在Ubuntu 14.04中创建用户 adduser

我想给它 须藤 访问。为此,我在两种方式之间感到困惑。

第一种方法是:如果我使用命令将该用户添加到sudo组 usermod -aG sudo

第二种方法是:如果我使用命令编辑sudoers文件 visudo 并添加一行 ALL=(ALL:ALL) ALL

请清除这两者之间的混淆。

Answers:


1

sudo 群体本身并不特殊。它有sudo访问权限,因为(如果)在这里有一条这样的行 sudoers 文件:

%sudo   ALL=(ALL:ALL) ALL

无论如何,这个文件真的很重要。


0

Ubuntu默认 /etc/sudoers 配置有两组允许sudo访问。允许这些组的成员进行sudo访问而无需编辑 /etc/sudoers 或者添加配置文件 /etc/sudoers.d

# 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

添加本地配置的首选方法是添加文件 /etc/sudoers.d 具有所需的配置。这允许自动更新默认配置。使用 visudo 至少验证这些变化

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.