setfacl 权限导出_linux学习-setfacl设置特定目录用户权限
需求:設置用戶test,test1對特定的目錄有讀寫執行權限,后加的文件也是這個權限。
-R表示遞歸 -m表示設置文件acl規則
setfacl -R -m d:u:test:rwx /data2/test
setfacl -R -m d:u:test1:rwx /data2/test
--刪除ACL規則使用-b
setfacl -R -b /data2/test
上面的d:u:詳見如下,而perms對應的是rwx:
setfacl命令可以識別以下的規則格式。
[d[efault]:][u[ser]:]uid[:perms]
指定用戶的權限,文件所有者的權限(如果uid沒有指定)。
[d[efault]:]g[roup]:gid[:perms]
指定群組的權限,文件所有群組的權限(如果gid未指定)
[d[efault]:]m[ask][:][:perms]
有效權限掩碼
[d[efault]:]o[ther][:perms]
#perms域是一個代表各種權限的字母的組合:讀:r 寫:w 執行:x,執行只適合目錄和一些可執行的文件。perms域也可設置為八進制格式0~7。
#其他的權限
Usage:setfacl[-bkndRLP]{-m|-M|-x|-X...}file... # -m|-M|-x|-X
-m,--modify=acl modify the current ACL(s)of file(s) #設置文件acl規則
-M,--modify-file=file read ACL entries to modify from file #從文件讀取訪問控制列表條目更改
-x,--remove=acl remove entries from the ACL(s)of file(s) #刪除文件的acl規則
-X,--remove-file=file readACL entries to remove from file #從文件讀取訪問控制列表條目并刪除
-b,--remove-all remove all extended ACL entries # 刪除所有擴展的acl規則,基本的acl規則(所有者,群組,其他)將被保留.
-k,--remove-default remove the defaultACL #刪除缺省的acl規則。如果沒有缺省規則,將不提示.
--set=acl set the ACL of file(s),replacing the current ACL.
--set-file=file readACL entries toset from file #從文件中讀設置ACL規則.
--mask dorecalculate the effective rights mask #重新計算有效權限,即使ACL mask被明確指定.
-n,--no-mask don'trecalculate the effective rights mask #不要重新計算有效權限。setfacl默認會重新計算ACL mask,除非mask被明確的制定.
-d,--default operations apply tothe defaultACL #設定默認的acl規則,針對目錄而言.
-R,--recursive recurse into subdirectories #遞歸的對所有文件及目錄進行操作.
-L,--logical logical walk,follow symbolic links #跟蹤符號鏈接,默認情況下只跟蹤符號鏈接文件,跳過符號鏈接目錄。
-P,--physical physical walk,donotfollow symbolic links #跳過所有符號鏈接,包括符號鏈接文件。
--restore=file restore ACLs(inverse of`getfacl-R') #從文件恢復備份的acl規則(這些文件可由getfacl -R產生)。通過這種機制可以恢復整個目錄樹的acl規則。此參數不能和除--test以外的任何參數一同執行.
--test testmode(ACLs are notmodified) #測試模式,不會改變任何文件的acl規則,操作后的acl規格將被列出.
-v,--version print version andexit #版本.
-h,--help thishelp text #不用說肯定是幫助了.
當使用-M,-X選項從文件中讀取規則時,setfacl接受getfacl命令輸出的格式。每行至少一條規則,以#開始的行將被視為注釋.
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的setfacl 权限导出_linux学习-setfacl设置特定目录用户权限的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 后端 消息 转发_【后端开发】Servl
- 下一篇: python录入学生信息网_干货满满 |