日期:2014-05-16  浏览次数:20805 次

linux 新增用户及增加该用户sudo权限
增加新用户,使用adduser命令:

root@AY130925102139735305Z:/home# sudo adduser xusongqin
Adding user `xusongqin' ...
Adding new group `xusongqin' (1000) ...
Adding new user `xusongqin' (1000) with group `xusongqin' ...
Creating home directory `/home/xusongqin' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for xusongqin
Enter the new value, or press ENTER for the default
Full Name []: xusongqin
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n] Y
root@AY130925102139735305Z:/home# ls
xusongqin

为该用户增加sudo权限:

# User privilege specification
root ALL=(ALL:ALL) ALL
xusongqin 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: