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