Linux特殊的文件控制权限FACL

本文介绍如何使用FACL(File Access Control List)进行文件权限管理。包括getfacl命令用于查看文件权限,setfacl命令用于设置文件的ACL权限。通过具体实例展示了如何为特定用户设置读写执行权限。

  对文件设置特殊的权限,FACL(File Access Control List)


 

ACL简介

基本ACL操作

getfacl  查看文件权限      setfacl  设定acl权限

设置file的ACL权限

[root@mvpbang tmp]# setfacl -m u:ftp:rwx 1.sh 
[root@mvpbang tmp]# 
[root@mvpbang tmp]# ll 1.sh 
-rw-rwxr--+ 1 ftp ftp 67 Sep 17 16:12 1.sh   #文件详情多个+
[root@mvpbang tmp]# getfacl 1.sh 
# file: 1.sh
# owner: ftp
# group: ftp
user::rw-
user:ftp:rwx     #多个附属的ftp的权限
group::r--
mask::rwx
other::r--

setfacl命令参数

[root@mvp tmp]# setfacl -h
setfacl 2.2.49 -- set file access control lists
Usage: setfacl [-bkndRLP] { -m|-M|-x|-X ... } file ...
  -m, --modify=acl        modify the current ACL(s) of file(s)
  -M, --modify-file=file  read ACL entries to modify from file
  -x, --remove=acl        remove entries from the ACL(s) of file(s)
  -X, --remove-file=file  read ACL entries to remove from file
  -b, --remove-all        remove all extended ACL entries
  -k, --remove-default    remove the default ACL
      --set=acl           set the ACL of file(s), replacing the current ACL
      --set-file=file     read ACL entries to set from file
      --mask              do recalculate the effective rights mask
  -n, --no-mask           don't recalculate the effective rights mask
  -d, --default           operations apply to the default ACL
  -R, --recursive         recurse into subdirectories
  -L, --logical           logical walk, follow symbolic links
  -P, --physical          physical walk, do not follow symbolic links
      --restore=file      restore ACLs (inverse of `getfacl -R')
      --test              test mode (ACLs are not modified)
  -v, --version           print version and exit
  -h, --help              this help text

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值