Manage Permissions with Access Control Lists

Access Control Lists (ACLs) are a very powerful tool for managing permissions within a file system. ACLs allow for arbitrary lists of specific users and groups to be given read, write, and/or execute permissions on any file or directory that you own. They provide a much more flexible mechanism for managing permissions than the traditional Unix "user, group, and other" permissions system.

While both the XSEDE-Wide File System and TACC's Corral support ACLs, not all file systems have this feature enabled. Please consult the appropriate user guide for questions about specific file systems.

Because Unix groups may vary from site to site, the XSEDE-wide file system currently does not support mapping of groups, and group permissions, across sites. However, ACLs are supported, and because these are an advanced form of user permissions, and user identities are re-mapped from site to site, we recommend the use of ACLs to allow other users to read and/or write to your folders in the XSEDE-Wide File System. ACLs provide the common UNIX read, write, and execute permissions for individual users or groups of users, and you may have as many ACL entries as necessary to achieve the precise set of permissions you need on a given file or directory.

Important note: Access Control Lists work only in an additive fashion and cannot be used to remove permissions granted through the regular UNIX permissions commands. For example, if you want all the members of a group but one to have access to a file, you cannot start by granting access to the group and then removing access for one user; instead, you must remove access for the whole group, then add the appropriate permissions for each individual.

The two important command-line tools for managing ACLs are "setfacl" and "getfacl". These commands are used to create or change ACLs, and to read the contents of an ACL, respectively. The man pages provide detailed documentation on both these commands.

Note that the command's output is in a specialized format that can also be used to set ACLs, as described below. You may use the wildcard ("*") character to generate ACL listings for all files which match a specific pattern, however this may produce a lot of output if there are many files in a given directory. You must have read access to the file or directory in question in order to read its ACLs.

You can use a named file, or a pipe with the "getfacl" command, to set complex ACLs or to copy ACLs from one file to another. The following commands save the output of the getfacl command to a file named "myfile.acl", and then reads that ACL to set the permissions on a second file:

login1$ getfacl file > myfile.acl
login1$ setfacl -M myfile.aclfile2

You can also use the "-R" flag for recursion and/or the wildcard character to set permissions for all files in a given directory tree. The following command sets permissions using the specification in "myfile.acl" set in the above example on all files in the current directory:

login1$ setfacl -M file.acl *

This command recursively sets permissions on all files and subdirectories of the named directory:

login1$ setfacl -R -M file.acldirectory/

There are a large number of possibilities with the use of ACLs, including setting and managing default ACLs. Explore the man pages for more details on all the available options.