单一用户的ACL权限设定

应用背景

想让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.
用同样的方法添加 cakin5用户
 
第二步:设置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

猜你喜欢

转载自cakin24.iteye.com/blog/2335922