首页 > 代码库 > linux acl 一些选项的解释

linux acl 一些选项的解释

1,有些朋友经常问,setfacl -X 或者 -M 是怎么用的一个用法,其实和-m , -x 是一个用法,系统文档一般使用,-m , -x 做样例解释,对文件目录添加扩展权限,一般很少-X ,-M去配置文件acl条目,可能对一些用心的初学者朋友,会有点捉急。

  文档里面的解释是: 

      The -m (--modify) and -M (--modify-file) options modify the ACL of a file or directory

      The  -x  (--remove)  and  -X  (--remove-file) options remove ACL entries

2,-M , -X 选项参数是文件 ,就是这样的 ^-^

  例如:配置 一个文件  acl.sh  额外权限 如下

    getfacl --omit-header acl.sh 没有配置acl 权限如下

         user::rw-
         group::r--
         other::r--

    setfacl -m u:user1:rwx acl.sh 配置acl 条目

    getfacl --omit-header acl.sh  配置后的权限

user::rw-
user:user1:rwx
group::r--
mask::rwx
other::r--

使用-M 配置 Acl 规则条目

echo -n ‘u:user1:rw‘ > acl.txt && setfacl -M acl.txt acl.sh

getfacl --omit-header acl.sh 获取如下

user::rw-
user:user1:rw-
group::r--
mask::rw-
other::r-

以上修改acl 条目方法,

删除acl条目是 -x -X

同理上面: 

  setfacl -x u:user1 acl.sh

  echo -n ‘u:user1‘ > acl.txt && setfacl -X acl.txt acl.sh

 

---------------------------------- END -------------------------------------------

 

 

     

linux acl 一些选项的解释