博客
关于我
linux命令:facl文件系统的访问控制列表
阅读量:802 次
发布时间:2023-02-03

本文共 1533 字,大约阅读时间需要 5 分钟。

facl命令简介:

       利用文件扩展保存额外的访问控制权限

1.命令格式:

setfacl [option] [perm]file

setfacl:设置facl访问控制权限

getfacl:查看facl访问控制权限

2.命令功能:

利用文件扩展保存额外的访问控制权限,设定文件的访问控制权限

3.命令参数:

    setfacl         

         -m: 设定facl权限

             u:UID:perm  set -m u:UID:perm file  

             g:GID:perm  set -m g:GID:perm file 

         -x:取消设定的facl权限  取消时只需要指定用户及UID

             u:UID   setfacl -x u:donggen /test/test1.sh

             g:GID

         -b: 取消所有扩展的acl设置


如果为特定的目录设定默认的facl权限,使得在该目录下新建的文件或者目录默认就具有facl权限,只能针对目录设定,用下面2条命令即可,一条使得在该目录下新建的目录或者文件用户具有facl权限,一条是使得在该目录下新建的目录或者文件某个组具有facl权限。

setfacl -m d:u:UID:perm  

setfacl -m d:g:UID:perm  

4.命令实例:

   1、给某个文件设定facl权限

 setfacl -m u:donggen:rw /test/test1.sh 设定用户donggen 对于/test/test1.sh文件具有读写权限

[root@xuelinux ~]# getfacl /test/test1.sh 

getfacl: Removing leading '/' from absolute path names

# file: test/test1.sh

# owner: root

# group: root

user::rwx

group::r-x

other::r-x

[root@xuelinux ~]# setfacl -m u:donggen:rw /test/test1.sh

[root@xuelinux ~]# getfacl

Usage: getfacl [-aceEsRLPtpndvh] file ...

Try `getfacl --help' for more information.

[root@xuelinux ~]# getfacl /test/test1.sh

getfacl: Removing leading '/' from absolute path names

# file: test/test1.sh

# owner: root

# group: root

user::rwx

user:donggen:rw-

group::r-x

mask::rwx   *mask表示设定的facl权限值不应超出此值。

other::r-x

  setfacl -m g:donggen:rw /test/test1.sh   给组设定facl权限。

2、取消设定的facl

  setfacl -x u:donggen /test/test1.sh

  setfacl -x g:donggen /test/test1.sh

*访问文件的权限顺序是:

ower->facl,user->group->facl,group->other

首先是看属主紧接着跟着的是facl设定的用户权限,接着看属组权限紧跟着

是设定的facl,group权限,最后看other权限。

本文转自wang650108151CTO博客,原文链接:
http://blog.51cto.com/woyaoxuelinux/1865640
 ,如需转载请自行联系原作者
你可能感兴趣的文章
No qualifying bean of type XXX found for dependency XXX.
查看>>
No qualifying bean of type ‘com.netflix.discovery.AbstractDiscoveryClientOptionalArgs<?>‘ available
查看>>
No resource identifier found for attribute 'srcCompat' in package的解决办法
查看>>
no session found for current thread
查看>>
no such file or directory AndroidManifest.xml
查看>>
No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
查看>>
NO.23 ZenTaoPHP目录结构
查看>>
no1
查看>>
NO32 网络层次及OSI7层模型--TCP三次握手四次断开--子网划分
查看>>
NOAA(美国海洋和大气管理局)气象数据获取与POI点数据获取
查看>>
NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata
查看>>
node exporter完整版
查看>>
Node JS: < 一> 初识Node JS
查看>>
Node JS: < 二> Node JS例子解析
查看>>
Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime(72)
查看>>
Node 裁切图片的方法
查看>>
Node+Express连接mysql实现增删改查
查看>>
node, nvm, npm,pnpm,以前简单的前端环境为什么越来越复杂
查看>>
Node-RED中Button按钮组件和TextInput文字输入组件的使用
查看>>
vue3+Ts 项目打包时报错 ‘reactive‘is declared but its value is never read.及解决方法
查看>>