创建一个root权限的用户

80 阅读1分钟

sudo useradd -m xx
sudo passwd xx

sudo usermod -aG sudo xx
sudo usermod -aG wheel xx


验证sudo权限: 切换到xx用户,并验证其sudo权限: 
su - xx sudo whoami 如果命令返回root,则表示xx用户已正确配置为具有sudo权限。



[root@ll ~]# sudo useradd -m xx
[root@ll ~]# sudo passwd xx
Changing password for user xx.
New password: 
Retype new password: 
passwd: all authentication tokens updated successfully.
[root@ll ~]# sudo usermod -aG sudo xx
usermod: group 'sudo' does not exist
[root@ll ~]# sudo usermod -aG wheel xx
[root@ll ~]# sudo usermod -aG sudo xx
usermod: group 'sudo' does not exist
[root@ll ~]# su - xx  
[xx@ll ~]$ sudo whoami

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for xx: 
root