當前位置:生活全書館 >

IT科技

> linux設定許可權的命令

linux設定許可權的命令

設定檔案夾許可權:

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

  • 文章版權屬於文章作者所有,轉載請註明 https://shqsg.com/dianzi/o2zr6y.html