linux如何給用户分配權限

1、添加用户
首先要用adduser命令添加一個普通用户,命令如下:
#adduser tommy //添加一個名為tommy的用户
#passwd tommy //修改密碼
Changing password for user tommy.
New UNIX password: //在這輸入新密碼
Retype new UNIX password: //再次輸入新密碼
passwd: all authentication tokens updated successfully.
2、賦予root權限
修改 /etc/sudoers 文件,找到下面一行,將前面的註釋符號(#)去掉
## Allows people in group wheel to run all commands
%wheel ALL=(ALL) ALL
接着修改用户,讓其能夠屬於root組(wheel),具體命令是:
#usermod -g root tommy

修改完畢之後就能夠使用tommy帳號登錄,接着用命令su -,就可以獲得root權限進行其他操作了。

linux如何給用户分配權限