NFSv4 ACLs
Jump to navigation
Jump to search
NFSv4 ACLs (Access Control Lists) are mechanism to manipulate access controls on network-mounted filesystems to supplement traditional Unix permissions.[1]
Commands
nfs4_setfacl
|
to add, remove, or modify the ACL |
This option is also being used for troubleshooting incorrect ACLs Fixing permissions that have gotten out-of-whack
|
nfs4_getfacl
|
prints out the ACL of the file or directory |
Access Control Entry (ACE)
ACE structure format,
[access type]:[flags]:[principal]:[permissions]
Where,
ACE entry | Description | ||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
access type | The 'A' denotes "Allow"
'D' can denote a Deny ACE | ||||||||||||||||||||||||||||||||||||||
flags |
| ||||||||||||||||||||||||||||||||||||||
principal |
| ||||||||||||||||||||||||||||||||||||||
permissions |
simlarly to POSIX Read/Write/Execute, aliases such as 'R', 'W', and 'X' represented as
|
Examples[2]
Check ACL on file or folder
$nfs4_getfacl file or folder
using an acl file
One can also specify the acl to be used in a single file, then apply that acl to avoid duplicate entries and keep the acl entries consistent.
$ cat << EOF > ~/group_acl.txt
A:fdg:clntstf@example.com:rxtncy
A::OWNER@:rwaDxtTnNcCy
A:g:GROUP@:tcy
A::EVERYONE@:rxtncy
EOF
$ nfs4_setfacl -R -S ~/group_acl.txt ~/share_group
using single cli command
1. Give auser read permissions to the file file1:
nfs4_setfacl -a "A::auser@example.com:R" file1
2. Allow the webserver running as user userweb to access your personal web directory (webhome), and all files underneath. You can use the find command and its -exec command to run a command on a set of files
find ~/webhome -type d -exec nfs4_setfacl -a "A::userweb@example.com</span>:RX" {} \;
That command gives RX (i.e. read and execute) permissions to all directories (the –type d option to find) under the ~webhome directory.
find ~/webhome -type f -exec nfs4_setfacl -a "A::userweb@example.com</span>:R" {} \;
The second command gives userweb read (R) access to any non-directory file (–type f) in ~webhome. Note, you may want to do this if you want certain files to be accessible via the web, e.g. behind a password, but not to local EECS users. Very useful for making answers to quizzes, etc. password protected.
3. Give your research group named research1, read access to your project directory project1:
find project1 -type d -exec nfs4_setfacl -a "A:g:research1@example.com</span>:RX" {} \;f
find project1 -type f -exec nfs4_setfacl -a "A:g:research1@example.com</span>:R" {} \;