打开acl功能

mount -o acl /dev/sda6 /opt/ 或者 tune2fs -o acl /dev/sda6

getfacl file/dir


setfacl -m u:tom:rw aa.txt   设置用户的acl

[root@localhost ~]# ll aa.txt

-rw-rw-r--+ 1 root root 9 07-25 12:16 aa.txt  #权限位后+,以acl的设置为准


[root@localhost ~]# getfacl aa.txt

# file: aa.txt

# owner: root

# group: root

user::rw-

user:tom:rw-   ---------------tom权限

group::r--

mask::rw-

other::r--


setfacl -m g:robin:rw aa.txt  设置组的acl

setfacl -m o:rwx aa.txt    设置其他人acl

setfacl -m m:r aa.txt   修改mask值 用于约束额外的用户和组权限

setfacl -x u:tom aa.txt  移除某个用户acl

setfacl -x g:robin aa.txt  移除某个组的acl

setfacl -b aa.txt  彻底删除facl设置