Linux基础知识[1]【ACL权限】

ACL权限。

1.对于文件的权限进行附加补充说明的一个权限设定方式。提供传统的权限以外的具体权限的设置,可以针对单一用户、单一文件、单一目录来进行r、w、x的权限设置。

-rw-r--r--. 1 root root 0 Nov  7 09:21 /mnt/file
               |
如果此位为“.”,代表该文件无权限列表
如果此位为“+”,代表该文件有权限列表

2.查看ACL权限。

[root@VM_225_102_centos mnt]# getfacl file 
# file: file
# owner: root
# group: root
user::rw-
group::r--
other::r--

3.如何设定ACL权限
setfacl -m <u|g|m>:<username|groupname> filename ##设定acl
setfacl -x <u|g>:<username|groupname> filename ##去除某个用户或组的ACL权限
setfacl -b filename ##删除文件上的ACL(文件权限列表)




****示例1如下<-x与-b的区别>:
[root@acl-host mnt]# ll
total 4
-rw-r--r--+ 1 root root 0 Nov  7 10:22 file
[root@acl-host mnt]# setfacl -x u:student file ##仅仅是去除某个用户或组的ACL权限
[root@acl-host mnt]# ll
total 4
-rw-r--r--+ 1 root root 0 Nov  7 10:22 file ##从"+"号可以看出该文件有权限列表
[root@acl-host mnt]# setfacl -b file ##删除文件上的ACL(文件权限列表)
[root@acl-host mnt]# ll
total 0
-rw-r--r--. 1 root root 0 Nov  7 10:22 file ##从“.”号可以看出该文件有权限列表


4.ACL默认权限
(1)
默认权限针对目录使用,让目录中所有新建文件都继承此权限。对目录本身不生效,也不影响目录中已存在的文件。
setfacl -m d:<u|g|o>:<username|groupname>:rwx directory 
(2)
setfacl -x d:<u|g|o>:<username|groupname>:rwx directory 



原文地址:https://www.cnblogs.com/aallenn/p/6700635.html