markdown Linux权限通过setfacl进行访问控制列表配置
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown Linux权限通过setfacl进行访问控制列表配置相关的知识,希望对你有一定的参考价值。
# Modify Linux Directory Permission via setfacl
``` bash
$ ls -ld /var/www
drwxr-xr-x 2 apache www 4096 Aug 7 13:53 /var/www
$ sudo setfacl -dRm u:apache:rwX,g:www:rwX /var/www
$ ls -ld /var/www
drwxr-xr-x+ 2 apache www 4096 Aug 7 13:53 /var/www
$ getfacl /var/www
# file: var/www
# owner: apache
# group: www
user::rwx
group::r-x
other::r-x
default:user::rwx
default:user:apache:rwx
default:group::r-x
default:group:www:rwx
default:mask::rwx
default:other::r-x
$ touch donkey
$ ls -l donkey
-rw-rw-r--+ 1 gene gene 0 Aug 7 13:57 donkey
$ getfacl donkey
# file: donkey
# owner: gene
# group: gene
user::rw-
user:apache:rwx #effective:rw-
group::rwx #effective:rw-
group:www:rwx #effective:rw-
mask::rw-
other::r--
```
Command overview
```bash
setfacl -dRm u:apache:rwX,g:www:rwX /var/www
```
- The `-d` flag specifies the operations apply to the Default ACL.
- The `-R` flag sets operations to apply recursively
- The `-m` indicates it will be a modification operation
Then after that it's pretty straight forward
- `u:USERNAME:permissions`
- `g:GROUPNAME:permissions`
以上是关于markdown Linux权限通过setfacl进行访问控制列表配置的主要内容,如果未能解决你的问题,请参考以下文章
Linux命令之精确控制文件访问权限setfacl
Linux ACL权限规划:getfacl,setfacl使用
Linux续-给文件增加用户权限 setfacl -m
setfacl命令的基本用法
setfacl命令基本用法
Linux ACL权限设置