FACL额外访问控制权限
2016-05-11 16:24
351 查看
一、简介
FACL(Filesystem Access Control List)是指文件访问控制列表,该属性可以利用文件扩展保存额外的访问控制权限,比如有一下情况:storm用需要创建一个test文件,他需要cathy用户同样具有rw权限,通常的权限控制做法是需要修改test文件的other权限为rw,但是这样做以后所有的用户都具有rw权限,带来极大的安全隐患,此时就该facl发挥作用的时候了。
FACL常用的命令有2个:setfacl和getfacl,这两个命令普通用户都具有执行权限。
二、查看文件的acl权限
可以看到,test文件只有基本的user、group、other权限,该文件对于other用户是只读文件
三、设置文件的acl权限
☞ 当设置完facl权限以后利用getfacl查看发现多了一行:user:cathy:rw- ,表名该文件针对于cathy用户拥有额外的权限rw,此时用户cathy就具有对文件test的读写权限,但对于其他用户该文件是只读的
☞ 如果用ls -al查看该文件,在权限一列的显示为:-rw-rw-r--+多了个+号,表示该文件具有额外的权限,使用getfacl命令即可查看
☞ 添加额外组权限只需将setfacl -m u:cathy:rw test命令中的u改为g即可
四、取消权限
五、参数说明
FACL(Filesystem Access Control List)是指文件访问控制列表,该属性可以利用文件扩展保存额外的访问控制权限,比如有一下情况:storm用需要创建一个test文件,他需要cathy用户同样具有rw权限,通常的权限控制做法是需要修改test文件的other权限为rw,但是这样做以后所有的用户都具有rw权限,带来极大的安全隐患,此时就该facl发挥作用的时候了。
FACL常用的命令有2个:setfacl和getfacl,这两个命令普通用户都具有执行权限。
二、查看文件的acl权限
[storm@centos common]$ touch test [storm@centos common]$ getfacl test # file: test # owner: storm # group: storm user::rw- group::rw- other::r--
可以看到,test文件只有基本的user、group、other权限,该文件对于other用户是只读文件
三、设置文件的acl权限
[storm@centos common]$ setfacl -m u:cathy:rw test [storm@centos common]$ getfacl test # file: test # owner: storm # group: storm user::rw- user:cathy:rw- group::rw- mask::rw- other::r-- [storm@centos common]$ ll total 4 -rw-rw-r--+ 1 storm storm 0 May 11 00:39 test
☞ 当设置完facl权限以后利用getfacl查看发现多了一行:user:cathy:rw- ,表名该文件针对于cathy用户拥有额外的权限rw,此时用户cathy就具有对文件test的读写权限,但对于其他用户该文件是只读的
☞ 如果用ls -al查看该文件,在权限一列的显示为:-rw-rw-r--+多了个+号,表示该文件具有额外的权限,使用getfacl命令即可查看
☞ 添加额外组权限只需将setfacl -m u:cathy:rw test命令中的u改为g即可
四、取消权限
[storm@centos common]$ setfacl -x u:cathy test
五、参数说明
[storm@host1 common]$ setfacl --help setfacl 2.2.49 -- set file access control lists Usage: setfacl [-bkndRLP] { -m|-M|-x|-X ... } file ... -m, --modify=acl modify the current ACL(s) of file(s) # 修改 -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 read ACL entries to remove from file # 根据配置文件取消 -b, --remove-all remove all extended ACL entries # 移除所有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 --mask do recalculate the effective rights mask -n, --no-mask don't recalculate the effective rights mask -d, --default operations apply to the default 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') --test test mode (ACLs are not modified) -v, --version print version and exit -h, --help this help text
相关文章推荐
- ORMLite数据库框架的简单使用
- poj 1182食物链(带权并查集)
- ViewController的生命周期分析和使用
- 数据挖掘十大算法之一C4.5
- 有关请求路径的总结 request.getContextPath()、request.getServletContext().getRealPath("")、request.getRequestURI
- 剑指offer 面试题(数值的整数次方)(5)
- caffe softmax_loss_layer 对于梯度下降的理解
- arcengine制作的应用程序系统不兼容,报错
- 退学,离家出走,卖房创业,在他即将烧完最后一笔钱时,获250万元融资
- Java编程中的vector类用法学习笔记
- ftp上传文件
- Bootstrap 组件之按钮(二)
- Chrome开发者工具不完全指南(二、进阶篇)
- JSP基本语法
- 每秒处理10万订单乐视集团支付架构
- HDU 5266 pog loves szh III (LCA)
- Unity3d 官方资源Car的主控脚本CarController翻译与详解
- redis概览
- c# List AddRange
- 分布式入门之4:二阶段提交