ubuntu + 为新用户帐户添加 root 权限

yae*_*ael 0 linux ubuntu sudo

我有 ubuntu 版本 - 12.04

这是 sudoers 文件

# 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

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d
Run Code Online (Sandbox Code Playgroud)

我创建了新用户 - test_app

我想授予与 %admin 用户相同的 root 权限

请告知我需要添加 VIA visudo 的附加行是什么?

Wis*_*lah 5

首先admin是一个组而不是一个用户,你可以根据角色来确定%

现在,对于您的问题,您可以通过将此行添加到文件中来sudo为用户添加完整权限:test_app

test_app    ALL=(ALL:ALL) ALL
Run Code Online (Sandbox Code Playgroud)

之后您可以使用sudo用户的任何内容test-app

但我建议您将用户添加到sudo组中,这样您就不必对 sudoers 文件进行任何更改:

usermod -a -G sudo test_app
Run Code Online (Sandbox Code Playgroud)