所有者,所有组,other其他。只有三个维度。
ACL 在文件本身的,user,group,other的rwx权限基础上,给某些user和group特定的权限。
需要文件所在分区是否支持ACL。 dumpe2fs显示文件系统属性。
dumpe2fs -h /dev/sda1
Default mount options: user_xattr acl
临时开启ACL
mount -o remount,acl / 重新挂载根分区
永久生效 /etc/fstab。 系统开机自动挂载文件。需要重启。
设置acl之后,文件目录权限发生改变,多了个+。
root@csc:/home/css/test# ls -ld project/
drwxrwx--- 2 root tgroup 4096 1月 15 15:43 project/
设置acl,给user st 权限rx。
root@csc:/home/css/test# setfacl -m u:st:rx project/
root@csc:/home/css/test# ls -ld project/
drwxrwx---+ 2 root tgroup 4096 1月 15 15:43 project/
查看acl
root@csc:/home/css/test# getfacl project/
# file: project/
# owner: root
# group: tgroup
user::rwx
user:st:r-x
group::rwx
mask::rwx
other::---
设置acl 组权限rwx。
root@csc:/home/css/test# setfacl -m g:tgroup2:rwx project/
root@csc:/home/css/test# getfacl project/
# file: project/
# owner: root
# group: tgroup
user::rwx
user:st:r-x
group::rwx
group:tgroup2:rwx
mask::rwx
other::---
如果用户st 属于tgroup2组,但是仍然不能在目录project下创建文件。因为指定st是rx。
如果用户test1属于组tgroup,当设置acl权限为rx,test1用户无法创建文件。
ACL设置高于标准的user,group,other权限设置。
root@csc:/home/css/test# setfacl -m u:test1:rx project/
root@csc:/home/css/test# getfacl project/
# file: project/
# owner: root
# group: tgroup
user::rwx
user:test1:r-x
user:st:r-x
group::rwx
group:tgroup2:rwx
mask::rwx
other::---
修改mask最大权限。交集。
root@csc:/home/css/test# setfacl -m m:rx project/
root@csc:/home/css/test# getfacl project/
# file: project/
# owner: root
# group: tgroup
user::rwx
user:bimm:r-x
user:st:r-x
group::rwx #effective:r-x
group:tgroup2:rwx #effective:r-x
mask::r-x
other::---
删除某一个acl属性。 -x。
root@csc:/home/css/test# setfacl -x g:tgroup3 project/
root@csc:/home/css/test# getfacl project/
# file: project/
# owner: root
# group: tgroup
user::rwx
user:bimm:r-x
user:st:r-x
group::rwx
group:tgroup2:rwx
mask::rwx
other::---
清除全部ACL属性。 -b
root@csc:/home/css/test# setfacl -b project/
root@csc:/home/css/test# getfacl project/
# file: project/
# owner: root
# group: tgroup
user::rwx
group::rwx
other::---
递归设置ACL
root@csc:/home/css/test/project# setfacl -m u:st:rx -R project/
默认ACL,新建的目录可以从父目录自动获取ACL。 d:
root@csc:/home/css/test# setfacl -m d:u:st:rx -R project/
阅读(878) | 评论(0) | 转发(0) |