mask
mask 权限,指的是用户或群组能拥有的最大 ACL 权限,也就是说,给用户或群组设定的 ACL 权限不能超过 mask 规定的权限范围,超出部分做无效处理。
mask:
用于临时降低用户或组(除属主和其他人)的权限
mask决定了他们的最高权限
建议:为了方便管理文件权限,其他人的权限置为空
root
[root@bogon ~]# touch /home/file1[root@bogon ~]# setfacl -m user:alice:r,user:jack:rw,g:hr:rwx /home/file1[root@bogon ~]# getfacl /home/file1getfacl: Removing leading '/' from absolute path names# file: home/file1# owner: root# group: rootuser::rw-user:alice:r--user:jack:rw-group::r--group:hr:rwxmask::rwxother::r--[root@bogon ~]# setfacl -m m::r /home/file1 //修改mask权限[root@bogon ~]# getfacl /home/file1getfacl: Removing leading '/' from absolute path names# file: home/file1# owner: root# group: rootuser::rw-user:alice:r--user:jack:rw- #effective:r--group::r--group:hr:rwx #effective:r--mask::r--other::r--[root@bogon ~]# setfacl -m m::- /home/file1 //修改mask权限[root@bogon ~]# getfacl /home/file1getfacl: Removing leading '/' from absolute path names# file: home/file1# owner: root# group: rootuser::rw-user:alice:r-- #effective:---user:jack:rw- #effective:---group::r-- #effective:---group:hr:rwx #effective:---mask::---other::r--[root@bogon ~]# setfacl -m o::- /home/file1 // 修改其他用户没有权限[root@bogon ~]# getfacl /home/file1getfacl: Removing leading '/' from absolute path names# file: home/file1# owner: root# group: rootuser::rw-user:alice:r--user:jack:rw-group::r--group:hr:rwxmask::rwxother::---[root@bogon ~]# setfacl -m m::- /home/file1 //修改mask权限为没有权限[root@bogon ~]# getfacl /home/file1getfacl: Removing leading '/' from absolute path names# file: home/file1# owner: root# group: rootuser::rw-user:alice:r-- #effective:---user:jack:rw- #effective:---group::r-- #effective:---group:hr:rwx #effective:---mask::---other::---
[alice@bogon ~]$ cat /home/file1
cat: /home/file1: 权限不够
default
default:继承(默认)
root
[root@bogon ~]# mkdir /111
[root@bogon ~]# setfacl -m d:u:alice:rwx /111
[root@bogon ~]# getfacl /111
getfacl: Removing leading '/' from absolute path names
# file: 111
# owner: root
# group: root
user::rwx
group::r-x
other::r-x
default:user::rwx
default:user:alice:rwx
default:group::r-x
default:mask::rwx
default:other::r-x
root
[root@bogon ~]# mkdir /111/222
[root@bogon ~]# getfacl /111/222
getfacl: Removing leading '/' from absolute path names
# file: 111/222
# owner: root
# group: root
user::rwx
user:alice:rwx
group::r-x
mask::rwx
other::r-x
default:user::rwx
default:user:alice:rwx
default:group::r-x
default:mask::rwx
default:other::r-x
[root@bogon ~]# setfacl -m u:alice:rwx /111 // 当前目设置acl权限
[root@bogon ~]# setfacl -m d:u:alice:rwx /111 // 以后创建的目录才会出现acl权限 d--defalut
