getfacl
權限與擁有者
用法
getfacl [path]印出存取控制清單,也就是超出擁有者、群組和其他人的按使用者額外權限;這是裝了 acl 套件的 Linux 的東西,macOS 用 ls -le 顯示它自己那套 ACL。
常用選項
| 選項 | 含義 |
|---|---|
| -R | Walk a whole tree |
| -d | Show the default ACL that new files will inherit |
| -a | Show only the ACL of the file itself |
| --omit-header | Leave out the three comment lines |
| -e | Print the effective rights after the mask is applied |
範例
getfacl report.pdfThe ACL plus the ordinary owner and group bits.
getfacl dir | setfacl --set-file=- other_dirCopies one ACL onto another directory.
ls -le report.pdfHow macOS shows its own kind of ACL instead.
數字模式和符號模式說的是同一件事:755 和 u=rwx,go=rx 是同一個權限。
怎麼看
- 方括號 [ ] 表示這部分可以不寫。
- 省略號 … 表示可以寫多個。
- 選項區分大小寫——有些命令裡 -r 和 -R 不是一回事。
常見問題
Q. getfacl 是做什麼的?
印出存取控制清單,也就是超出擁有者、群組和其他人的按使用者額外權限;這是裝了 acl 套件的 Linux 的東西,macOS 用 ls -le 顯示它自己那套 ACL。
Q. 怎麼寫?
getfacl [path] —— 方括號表示可以省略的部分。
Q. 值得記的選項有幾個?
這裡列了 5 個,完整列表在 man getfacl。這條命令屬於權限與擁有者。
相關命令
man 手冊: man getfacl