(1)
[root@www test]# getfacl /home/test
getfacl: Removing leading '/' from absolute path names
# file: home/test
# owner: root
# group: root
user::rwx
group::r-x
other::r-x
[root@www test]#
[root@www test]# getfacl /home/test
getfacl: Removing leading '/' from absolute path names
# file: home/test
# owner: root
# group: root
user::rwx
user:helen:rw-
group::r-x
mask::rwx
other::r-x
(2)
[root@www test]# touch testACL2
[root@www test]# getfacl testACL2
# file: testACL2
# owner: root
# group: root
user::rw-
group::r--
other::r--
[root@www test]# setfacl -m u:centos:rw -R /home/test
//赋予testACL2的父目录/home/test具有递归ACL权限,
//此时子目录和和子文件也具有了该ACL权限,查看testACL2,也具有了该ACL权限
# file: testACL2
# owner: root
# group: root
user::rw-
user:centos:rw-
group::r--
mask::rw-
other::r—
(3)
[root@www test]# touch testACL3
[root@www test]# getfacl testACL3
//此时testACL5文件并不具有父目录的ACL权限:u:centos:rw,
//由此可见,递归ACL权限只对已存在的子目录和子文件有效,而对新建的子目录和文件无效
# file: testACL3
# owner: root
# group: root
user::rw-
group::r--
other::r--
(4)默认ACL权限
默认ACL权限的作用是:如果给父目录设定了ACL权限,那么父目录中所有新建的子文件都会继承父目录的ACL权限
[root@www test]# setfacl -m d:u:samlee:rw -R /home/test
[root@www test]# getfacl /home/test
getfacl: Removing leading '/' from absolute path names
# file: home/test
# owner: root
# group: root
user::rwx
user:centos:rw-
user:helen:rw-
group::r-x
mask::rwx
other::r-x
default:user::rwx
default:user:samlee:rw-
default:group::r-x
default:mask::rwx
default:other::r-x
[root@www test]# touch testACL5
[root@www test]# getfacl testACL5
# file: testACL5
# owner: root
# group: root
user::rw-
user:samlee:rw-
group::r-x
mask::rw-
other::r—
注意:并且此时会有如下情况:新建的子目录的权限继承了父目录默认的ACL权限,并且该子目录的默认目录也继承了父母目录的默认目录的ACL权限
[root@www test]# mkdir testdir
[root@www test]# getfacl testdir
# file: testdir
# owner: root
# group: root
user::rwx
user:samlee:rw-
group::r-x
mask::rwx
other::r-x
default:user::rwx
default:user:samlee:rw-
default:group::r-x
default:mask::rwx
default:other::r-x
注意:子目录testdir下载新建子目录testdir2,其权限继承了testdir的默认权限,但是testdir2不在有默认的ACL权限
[root@www test]# cd testdir
[root@www testdir]# touch testdir2
[root@www testdir]# getfacl testdir2
# file: testdir2
# owner: root
# group: root
user::rw-
user:samlee:rw-
group::r-x
mask::rw-
other::r—
(5)删除默认目录
[root@www testdir]# cd ..
[root@www test]# setfacl -k testdir
getfacl: testdir: No such file or directory
# file: testdir
# owner: root
# group: root
user::rwx
user:samlee:rw-
group::r-x
mask::rwx
other::r-x
(6)删除某项权限
[root@www test]# setfacl -m u:userzs:rwx,u:samlee:rwx testACL2
[root@www test]# getfacl testACL2
# file: testACL2
# owner: root
# group: root
user::rw-
user:centos:rw-
user:samlee:rwx
user:userzs:rwx
group::r--
mask::rwx
other::r—
//删除用户userzs对文件testACL2的ACL权限
[root@www test]# setfacl -x u:userzs testACL2
[root@www test]# getfacl testACL2
# file: testACL2
# owner: root
# group: root
user::rw-
user:centos:rw-
user:samlee:rwx
group::r--
mask::rwx
other::r—
//删除文件testACL2所有的ACL权限
[root@www test]# setfacl -b testACL2
[root@www test]# getfacl testACL2
# file: testACL2
# owner: root
# group: root
user::rw-
group::r--
other::r--