HOWTO: Use NFSv4 ACL
This document shows you how to use the NFSv4 ACL permissions system. An ACL is a list of permissions associated with a file or directory. These permissions allow you to restrict access to a certian file or directory by user or group. NFSv4 ACLs provide more specific options than typical POSIX read/write/execute permissions used in most systems.
Understanding NFSv4 ACL
This is an example of an NFSv4 ACL
A::user@nfsdomain.org:rxtncy
A::alice@nfsdomain.org:rxtncy
A::alice@nfsdomain.org:rxtncy
A::alice@nfsdomain.org:rxtncy
The following sections will break down this example from left to right and provide more usage options
ACE Type
The 'A' in the example is known as the ace type. The 'A' denotes "Allow" meaning this ACL is allowing the user or group to perform actions requiring permissions. Anything that is not explicitly allowed is denied by default.
Note: 'D' can denote a Deny ACE. While this is a valid option, this ACE type is not reccomended since any permission that is not explicity granted is automatically denied meaning Deny ACE's can be redundant and complicated.
ACE Flags
The above example could have a distinction known as a flag shown below
A:d:user@osc.edu:rxtncy
The 'd' used above is called an inheritence flag. This makes it so the ACL set on this directory will be automatically established on any new subdirectories. Inheritence flags only work on directories and not files. Multiple inheritence flags can be used in combonation or omitted entirely. Examples of inheritence flags are listed below:
Flag | Name | Function |
---|---|---|
d | directory-inherit | New subdirectories will have the same ACE |
f | file-inherit | New files will have the same ACE minus the inheritence flags |
n | no-propogate inherit | New subdirectories will inherit the ACE minus the inheritence flags |
i | inherit-only | New files and subdirectories will have this ACE but the ACE for the directory with the flag is null |
ACE Principal
The 'user@nfsdomain.org' is a principal. The principle denotes the people the ACL is allowing access to. Principals can be the following:
- A named user
- Example: user@nfsdomain.org
- Special principals
- OWNER@
- GROUP@
- EVERYONE@
- A group
- Note: When the principal is a group, you need to add a group flag, 'g', as shown in the below example
-
A:g:group@osc.edu:rxtncy
ACE Permissions
The 'rxtncy' are the permissions the ACE is allowing. Permissions can be used in combonation with each other. A list of permissions and what they do can be found below:
Permission | Function |
---|---|
r | read-data (files) / list-directory (directories) |
w | write-data (files) / create-file (directories) |
a | append-data (files) / create-subdirectory (directories) |
x | execute (files) / change-directory (directories |
d | delete the file/directory |
D | delete-child : remove a file or subdirectory from the given directory (directories only) |
t | read the attributes of the file/directory |
T | write the attribute of the file/directory |
n | read the named attributes of the file/directory |
N | write the named attributes of the file/directory |
c | read the file/directory ACL |
C | write the file/directory ACL |
o | change ownership of the file/directory |
Note: Aliases such as 'R', 'W', and 'X' can be used as permissions. These work simlarly to POSIX Read/Write/Execute. More detail can be found below.
Alias | Name | Expansion |
---|---|---|
R | Read | rntcy |
W | Write | watTNcCy (with D added to directory ACE's |
X | Execute | xtcy |
Using NFSv4 ACL
This section will show you how to set, modify, and view ACLs
Set and Modify ACLs
To set an ACE use this command:
nfs4_setfacl [OPTIONS] COMMAND file
To modify an ACE, use this command:
nfs4_editfacl [OPTIONS] file
Where file is the name of your file or directory. More information on Options and Commands can be found below.
Options
Options can be used in combination or ommitted entirely. A list of options is shown below:
Option | Name | Function |
---|---|---|
-R | recursive | Applies ACE to a directory's files and subdirectories |
-L | logical | Used with -R, follows symbolic links |
-P | physical | Used with -R, skips symbolic links |
Commands
Commands are only used when first setting an ACE. Commands and their uses are listed below.
View ACLs
To view ACLs, use the following command:
nfs4_getfacl file
Where file is your file or directory
Supercomputer:
Service: