Skip to content

08. Access Control Lists

Standard Linux permissions (User, Group, Others) are often too rigid for complex environments. For example, what if you need to give User A Read/Write access, and User B Read-Only access, but neither user is the owner, and they don’t share a group?

This is where Access Control Lists (ACL) come in.


An ACL provides a fine-grained permission mechanism for file systems. It allows administrators to assign specific permissions to multiple arbitrary users or groups beyond the standard UGO (User, Group, Others) triad.

When a file or directory has an active ACL applied to it, a + symbol appears at the end of its permission string when running ls -l (e.g., -rw-rwxr--+).


To view and modify ACLs, Linux provides two primary utilities: getfacl and setfacl.

Reads and displays the ACL entries for a file or directory:

Terminal window
getfacl secret_data.txt

Example Output:

secret_data.txt
# owner: root
# group: root
user::rw-
user:alice:rw- <-- ACL entry specifically for Alice
group::r--
mask::rw-
other::r--

Modifies, adds, or removes ACL entries:

Terminal window
# Give a specific user (alice) Read and Write permissions
sudo setfacl -m u:alice:rw secret_data.txt
# Give a specific group (devs) Read and Execute permissions
sudo setfacl -m g:devs:rx /app/scripts/
# Apply ACL recursively across an entire directory tree (-R)
sudo setfacl -R -m g:devs:rwx /srv/shared/
# Remove a specific user's ACL entry (-x)
sudo setfacl -x u:alice secret_data.txt
# Remove ALL ACL entries from a file (revert to standard POSIX permissions)
sudo setfacl -b secret_data.txt

The mask acts as a ceiling or maximum allowable permission for all ACL users and groups (except the file owner). If you set the mask to Read-Only (r--), even if you grant alice Read/Write (rw-) via an ACL, her effective permissions are capped at Read-Only:

Terminal window
# Set the maximum allowed ACL permissions to Read and Execute
sudo setfacl -m m::rx secret_data.txt

Standard Linux permissions do not have true inheritance; a new file uses the process umask rather than inheriting the parent directory’s mode.

Default ACLs (-d) provide true directory inheritance. When applied to a directory, any new file or subdirectory created inside it automatically inherits those ACL rules:

Terminal window
# Add a Default ACL (-d flag) giving the 'devs' group Read/Write access
sudo setfacl -d -m g:devs:rw /app/shared_data/

A common scenario in enterprise operations is provisioning a department-shared directory where team members require collaborative Read/Write access while maintaining base ownership:

Terminal window
# 1. Create the departmental shared directory
sudo mkdir -p /finance
# 2. Grant accounting group full read, write, and execute permissions
sudo setfacl -m g:accounting:rwx /finance
# 3. Configure default ACLs so all newly created files inherit accounting access
sudo setfacl -d -m g:accounting:rwx /finance
# 4. Verify the active configuration
getfacl /finance

Verification output:

# file: finance
# owner: root
# group: root
user::rwx
group::r-x
group:accounting:rwx
mask::rwx
other::r-x
default:user::rwx
default:group::r-x
default:group:accounting:rwx
default:mask::rwx
default:other::r-x
  1. Multi-User/Group Flexibility: Assign discrete access tiers without cluttering system /etc/group definitions.
  2. Preserves Base Security: Leaves base user and group ownership intact.
  3. Automated Inheritance: Eliminates permission breakage when multiple services or team members create files in shared storage.

Mechanism Purpose Scope Primary Tools
UGO Permissions Basic file access (Owner, Group, Others) Standard 3-class access chmod, chown, chgrp
Umask Controls default permissions for newly created files/directories Session / System-wide creation filter umask
Special Permissions Privilege escalation (SUID) and group/delete control (SGID, Sticky) Process execution & directory behavior chmod 4755, chmod 2770, chmod 1777
ACLs Granular multi-user and multi-group permissions with inheritance Filesystem-level extended access getfacl, setfacl

08.6 Troubleshooting & Permission Pitfalls

Section titled “08.6 Troubleshooting & Permission Pitfalls”

When debugging “Permission Denied” errors, always follow structured diagnostic steps:

  1. Inspect for the + indicator: If ls -l shows -rwxr-xr-x+, standard chmod does not represent total permissions. Run getfacl to view all active rules.
  2. Mask conflicts: If an ACL user cannot write despite having rw-, check the mask line in getfacl. When restricted, an effective notation like #effective:r-- indicates mask throttling.
  3. Filesystem Support: While modern ext4 and XFS enable ACLs by default, legacy filesystems may require the acl mount option in /etc/fstab.
  • chmod 777 as a quick fix: Never apply 777. Identify the exact execution user or group and assign specific rights with chown or setfacl.
  • Root-owned volume mounts in Docker: Host paths bind-mounted into containers retain host UID/GID ownership. If owned by root:root, non-root container processes will crash with permission errors.
  • Directory Traversal: Accessing a file requires Execute (x) permissions on the containing directory and all ancestor directories up to /.