当前位置:网站首页>Basic usage of setfacl command

Basic usage of setfacl command

2022-06-24 00:14:00 noravinsc

1、setfacl Use of

setfacl Commands can be used to subdivide linux File permissions under .
chmod The command divides the file permissions into u,g,o Three groups , and setfacl You can set more precise file permissions for each file or directory .
let me put it another way ,setfacl You can control the distribution of permissions more precisely .
such as : Let a user have some permissions on a file .

This is independent of the tradition u,g,o Of rwx The specific permission setting outside the permission is called ACL(Access Control List)
ACL For a single user 、 A single file or directory r,w,x Permission control , It is helpful for the usage of special permission .
Such as , A document , Don't let a single user access .

2、setfacl Usage of
Take an example :

[[email protected] ~]# getfacl test # see acl

file: test

owner: root

group: root

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

[[email protected] ~]# setfacl -m u:tank:rx test # to tank The user to test Increase the reading and execution of files acl The rules
[[email protected] ~]# getfacl test # see acl

file: test

owner: root

group: root

user::rw-
user:tank:r-x # Joined
group::r–
mask::r-x
other::r–

[[email protected] ~]# setfacl -m u::rwx test # Set default user , read , Write , Executable
[[email protected] ~]# getfacl test

file: test

owner: root

group: root

user::rwx
user:tank:r-x
group::r–
mask::r-x
other::r–

[[email protected] ~]# setfacl -b test # Clear all acl
[[email protected] ~]# getfacl test

file: test

owner: root

group: root

user::rwx
group::r–
other::r–

[[email protected] ~]# setfacl -m u:tank:rx test # to tank The user to test Increase the reading and execution of files acl The rules
[[email protected] ~]# setfacl -m u:testtank:rx test # to testtank The user to test Increase the reading and execution of files acl The rules
[[email protected] ~]# getfacl test

file: test

owner: root

group: root

user::rwx
user:testtank:r-x
user:tank:r-x
group::r–
mask::r-x
other::r–

[[email protected] ~]# setfacl -x u:tank test # eliminate tank user , Yes test file acl The rules
[[email protected] ~]# getfacl test

file: test

owner: root

group: root

user::rwx
user:testtank:r-x
group::r–
mask::r-x
other::r–

To set up a group, you just need to put setfacl -m u::rwx Medium u Change it to g that will do , About the same .

Set up mask Words ,setfacl -m u::rwx Medium u Change it to m, And this is not for users and groups , The others are about the same .

In the use of -R when , Remember to put it in -m front , Otherwise, you can't

Use -d Words , Will add the default , For the directory .

原网站

版权声明
本文为[noravinsc]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206232226380178.html