作者: Tscccn |
日期: 2013 年 01 月 08 日 |
围观: 7033次+ |
1 条评论
setfacl,顾名思义就是设置文件的ACL规则。
而Acl(Access Control List)就是访问控制列表,最初好像是unix里面为了提供更高级的权限管理而搞出来的。
可能是被chmod命令的3个权限控制无法满足,而被迫搞出来的吧!
ACL的设置技巧
1 2 |
getfacl: 取得某个文件/目录的ACL设置项目 setfacl: 设置某个目录/文件的ACL规定 |
查看磁盘是否支持acl
1 2 |
[root@kinggoo.com ~]# tune2fs -l /dev/hda1 | grep option Default mount options: user_xattr acl |
–help一下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
[root@kinggoo.com ~]# setfacl --help setfacl 2.2.39 -- set file access control lists Usage: setfacl [-bkndRLP] { -m|-M|-x|-X ... } file ... # -m|-M|-x|-X -m, --modify=acl modify the current ACL(s) of file(s) #设置文件acl规则(s估计是sock文件) -M, --modify-file=file read ACL entries to modify from file #修改文件acl规则 -x, --remove=acl remove entries from the ACL(s) of file(s) #删除文件的acl规则(s估计是sock文件) -X, --remove-file=file read ACL entries to remove from file #删除文件的acl规则 -b, --remove-all remove all extended ACL entries # 删除所有扩展的acl规则,基本的acl规则(所有者,群组,其他)将被保留. -k, --remove-default remove the default ACL #删除缺省的acl规则。如果没有缺省规则,将不提示. --set=acl set the ACL of file(s), replacing the current ACL. --set-file=file read ACL entries to set from file #从文件中读设置ACL规则. --mask do recalculate the effective rights mask #重新计算有效权限,即使ACL mask被明确指定. -n, --no-mask don't recalculate the effective rights mask #不要重新计算有效权限。setfacl默认会重新计算ACL mask,除非mask被明确的制定. -d, --default operations apply to the default ACL #设定默认的acl规则,针对目录而言. -R, --recursive recurse into subdirectories #递归的对所有文件及目录进行操作. -L, --logical logical walk, follow symbolic links #跟踪符号链接,默认情况下只跟踪符号链接文件,跳过符号链接目录。 -P, --physical physical walk, do not follow symbolic links #跳过所有符号链接,包括符号链接文件。 --restore=file restore ACLs (inverse of `getfacl -R') #从文件恢复备份的acl规则(这些文件可由getfacl -R产生)。通过这种机制可以恢复整个目录树的acl规则。此参数不能和除--test以外的任何参数一同执行. --test test mode (ACLs are not modified) #测试模式,不会改变任何文件的acl规则,操作后的acl规格将被列出. -v, --version print version and exit #版本. -h, --help this help text #不用说肯定是帮助了. |
当使用-M,-X选项从文件中读取规则时,setfacl接受getfacl命令输出[……]
最新评语