应用背景
想让student可以进入/home/cakingroups这个目录进行查询但不可写入。同时cakin5在/home/cakingroups内不具有任何权限。
[root@localhost ~]# useradd student
[root@localhost ~]# passwd student
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
第二步:设置ACL权限
[root@localhost ~]# setfacl -m u:student:rx /home/cakingroups
[root@localhost ~]# setfacl -m u:cakin5:- /home/cakingroups
第三步:查看权限
[root@localhost ~]# getfacl /home/cakingroups
getfacl: Removing leading '/' from absolute path names
# file: home/cakingroups
# owner: root
# group: cakingroup
# flags: -s-
user::rwx
user:cakin5:---
user:student:r-x
group::rwx
mask::rwx
other::---
[root@localhost ~]# ll -d /home/cakingroups
drwxrws---+ 2 root cakingroup 6 Nov 6 11:04 /home/cakingroups