Linux基本許可權管理

weixin_33858249發表於2017-12-07

一. 檔案基本許可權

1.   - 檔案型別,第一個字元為-,代表是檔案型別(-檔案      d目錄     | 軟連結檔案)

2.  總共10個字元,2~10 總共9個字元,每三個字元為一組

     rw-   u所有者的許可權

     r--     g所屬組的許可權

     r--     o其他人的許可權

3. r 讀     w 寫      x執行

4. 上圖中所有者為root,許可權rw- 

    所屬組為root, 許可權為r--

    其他 許可權為r--

 

二、 修改許可權 chmod命令

chmod [選項] 模式  檔名

選項 -R 遞迴

模式  [ugoa][+-=][rwx]   [mode=421]

1. chmod u+x  hello.txt

針對hello.txt 檔案,給當前使用者,增加x可執行許可權

2.  chmod g+x,o+x hello.txt

就是對所屬組和其他增加寫許可權

3. 刪除剛才增加的許可權

命令為 chmod u-x,g-w,o-w hello.txt

4. chmod u=rwx hello.txt

修改當前使用者的許可權為rwx

5. chomd a=rw hello.txt

給所有人賦予rw許可權

 

三、許可權的數字表示

r ----   4

w ----  2

x ---- 1

rwx r-x r-x

7     5    5

如 chmod 755 hello.txt



本文轉自Work Hard Work Smart部落格園部落格,原文連結:http://www.cnblogs.com/linlf03/p/8098131.html,如需轉載請自行聯絡原作者

相關文章