Set the access control list (ACL) for files or directories
setfacl [-bn] [-m entry[,entry...]] [-M acl_file] [-x entry[,entry...]] [-X acl_file] [path ...]
- Remove all the extended ACLs from the specified files and directories.
- -M acl_file
- Merge the entries (see below) given in acl_file into the ACLs of the specified files and directories. If you specify a hyphen (-) for acl_file, setfacl reads the entries, one per line, from standard input until you press CtrlD.
- -m entry[,entry...]
- Merge the given entries into the ACLs of the specified files and directories.
- Don't recalculate the permissions associated with the ACL mask entry.
- -X acl_file
- Remove the entries given in acl_file from the ACLs of the specified files and directories. If you specify a hyphen (-) for acl_file, setfacl reads the entries, one per line, from standard input until you press CtrlD.
- -x entry[,entry...]
- Remove the given entries from the ACL of the specified files and directories.
- path ...
- The file or directory that you want to set the ACL for. If you specify a hyphen (-) or don't specify any paths, setfacl reads them, one per line, from standard input until you press CtrlD.
The setfacl utility modifies the access control list for files or directories. ACLs extend the traditional permissions as set with chmod, giving you finer control over who has access to what. The classes of permissions are:
- owner class
- group class, consisting of named users, the owning group, and named groups
- others (or world) class
For an overview of ACLs, see Access Control Lists (ACLs) in the BlackBerry 10 OS User's Guide.
If you're using the -M or -m option, each entry is in one of the following forms:
|Named user (identified by name or by ID)||user:user_name:permissions|
|Named group (identified by name or ID)||group:group_name:permissions|
|The upper bound on permissions for the group class.||mask::permissions|
If you wish, you can specify just the first letter of user, group, mask, and other. The permissions are a combination of r (read), w (write), x (execute), and - (no permission). You can put these characters in any order and omit any no permission hyphens. If the entry already exists in the ACL, the existing permissions are replaced by the new ones.
If you're using the -X or -x option, the permissions are ignored, and all permissions are removed for the specified mask, named user, or named group. You can't remove the entries for the owner, owning group, or others.
- Changes that you make to ACLs are kept only until you reboot the system.
- Changes to an ACL can affect the file permissions (i.e., permissions as could be set by chmod). The changes to the file permissions do persist across reboots.
Add read-only permission for a specific user:
# setfacl -m user:frank:r my_file # getfacl my_file # file: my_file # owner: mabel # group: docs user::rw- user:frank:r-- group::rw- mask::rw- other::r--
Remove the permissions specified in my_acl from a file:
# cat my_acl user:frank: # setfacl -X my_acl my_file
- > 0
- An error occurred.