Set Linux FileSystem ACL
Access control lists can be read and set on Linux file systems with the commands getfacl
and setfacl
.
To get user IDs instead of usernames for the owner and group, use the -n
parameter like this: getfact -n /my_data
.
Example of setting an acl entry: setfacl -m u:nitin:rw myfile.txt
(-m
is to modify, -x
is to remove Eg. setfacl -x u:nitin myfile.txt
)
ACLs can be copied with: getfacl directory_1 | setfact -R --set-file=- directory_2
(the hyphen for the --set-file
tells setfacl
to read the filename from STDIN)
See more at: https://www.golinuxcloud.com/setfacl-getfacl-command-in-linux