Table of Contents

Advanced Permissions - NFSv4 ACLs

Traditional UNIX/Linux permissions with owner, group, and “other” permissions and modes are sufficient for a large number of applications. However, sometimes a richer permission model is required to give exactly the correct level of access to a file or directory. NFSv4 ACLs (Access Control Lists) are mechanism to manipulate access controls on EECS network-mounted filesystems to supplement traditional Unix permissions. Network mounted file systems include every user's /home/username home directory and directories in /research and /storage.

Commands


Access Control Entries (ACE)

An ACE, or Access Control Entry, is a single control statement, indicating the access of a specific entity (a user or group usually). Thus, an Access Control List (ACL) is a list of ACEs. This article will discuss some simple and common options for an ACE, but for a full description, see the nfs4_acl(5) man page.
We will begin with the structure of an ACE:

[access type]:[flags]:[principal]:[permissions]

All parts are required for every operation, though the [flags] section may be empty.




Notes

Full Permission Entries

As mentioned above, the permissions outlined in this article are short-cuts for the actual full permissions which extend beyond read, write, and execute. That means there are many other flags which govern such access as editing the ACL on a file itself or trigger certain audit alarms when a file is accessed. When viewing the ACL for a file with nfs4_getfacl, you will notice many other permission entries for a file:

jruser:hydra9 ~> nfs4_getfacl testfile

# file: testfile
A::OWNER@:rwatTcCy
A::GROUP@:tcy
A::EVERYONE@:tcy

In general, for setting ACEs, it is recommended you stick with the shortcuts. And, if you are unsure, use the –test flag to see what your operation would do.

There are exceptions in certain operations–e.g. when removing an ACE–that the real permissions must be specified exactly. Furthermore, if, in setting an ACE, you use the real permissions rather than one of the shortcuts, you must specify all of them.

Inheritance

Inherited permissions are a particularly tricky case for a variety of technical reasons which are beyond the scope of this article. EECS IT recommends that you don't use inherited permissions unless you have familiarized yourself well with NFSv4 ACLs by reading all the manual pages linked to this article. That said, here are a few caveats if you need to use them:

Troubleshooting Incorrect ACLs

Fixing permissions that have gotten out-of-whack is a potentially frustrating process. If you find yourself in such a situation, open permissions in edit mode (the -e< option to nfs4_setfacl) and removing all the non-standard permissions (everything other than the non-inherited OWNER@, GROUP@, and EVERYONE@ entries), and starting over. It may be easier than fixing a messed up ACL.

Examples

  1. Give joeuser read permissions to the file file1:
    nfs4_setfacl -a "A::joeuser@eecs.utk.edu: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@eecs.utk.edu</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@eecs.utk.edu</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@eecs.utk.edu</span>:RX" {} \;f
    find project1 -type f -exec nfs4_setfacl -a "A:g:research1@eecs.utk.edu</span>:R" {} \;

    Much like in the web server example, you can use the find command to specify one set of permissions (RX) for directories and a slightly different one for files.