開心生活站

位置:首頁 > IT科技 > 

linux設置權限的命令

IT科技5.63K

設置文件夾權限:

1、首先要查看linux系統版本,比如cat /etc/redhat-release ,然後進入到需要查看的文件夾目錄。

linux設置權限的命令

2、修改設置文件夾權限通常是使用chmod命令,比如“chmod 755 文件目錄名”。

linux設置權限的命令 第2張

設置用戶權限:

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權限進行其他操作了。