ACL访问控制权限

1 .使用getfacl命令查看文档的ACL权限

格式:getfacl 文件或目录
下面是操作实例:

[root@localhost ~]# getfacl /tmp/test
# file: etc
# owner: root
# group: root
user::rwx                   //所有者权限
group::r-x                  //所属组权限
other::r-x                  //其他人权限

从以上输出可以看出,该目录未设置附加的ACL访问控制条目,仅有基本的目录所有者、所属组、其他人的访问控制。

2.下面使用setfacl命令设置文档访问控制列表。

格式:setfacl [选项] [{-m|x} acl条目] 文件或目录
选项:
-b 删除所有的ACL条目
-m 添加ACL条目
-x 删除指定的ACL条目
-R 递归处理所有的子文件和子目录

[root@localhost test]# setfacl -m u:gao:rwx 1.txt         //添加acl条目,使用户gao对1.txt文件可读,可写,可执行
[root@localhost test]# setfacl -m g:gao:rwx 1.txt         //添加acl条目,使gao组对1.txt文件可读,可写,可执行
[root@localhost test]# setfacl -x u:gao 1.txt             //删除用户gao的acl条目
[root@localhost test]# setfacl -x g:gao 1.txt             //删除gao组的acl条目
[root@localhost test]# setfacl -b 1.txt                   //删除文件1.tx所有附加的acl条目

猜你喜欢

转载自blog.csdn.net/gao_2109/article/details/93889900
今日推荐