Skip to main content
RunBook Academy

LinuxIII · Filesystems and FilesPermissions

POSIX ACLs — fine-grained permissions beyond owner/group/other

Intermediate⏱ ~12 minbashgetfaclsetfaclls

What you'll learn

  • Explain when ACLs are needed vs the standard owner/group/other model
  • Use getfacl and setfacl to read and modify ACLs
  • Recognise the default ACL on a directory and how it propagates
  • Plan for ACL portability across systems and backup tools

Prerequisites

Verified against Ubuntu 24.04 LTS · Debian 12 (Bookworm) · RHEL 9.x · Rocky Linux 9.x · AlmaLinux 9.x · Linux kernel 6.1 LTS / 6.6 LTS · systemd 255+ · OpenSSH 8.7p1 (RHEL 9) / 9.6p1 (Ubuntu 24.04) · nftables 1.0.x · chrony 4.x · Pacemaker 2.1.x · Corosync 3.1.x · 2026-08-09

Not yet marked complete on this device.

Standard Linux permissions distinguish only owner, group, and other. That model breaks down when two users need different permissions on the same file, or when a directory needs to give one group read access and another group write access. POSIX ACLs extend the model.

When standard permissions are not enough

Consider these scenarios:

  • A shared /srv/data directory must be writable by group devs AND readable by group auditors, with nothing for others.
  • A log file is owned by the application but specific engineers need read access without joining the application’s group.
  • A build directory needs to be writable by a CI service user and the human engineers who ship to it.

POSIX ACLs handle these cases directly. The standard toolchain is getfacl to read and setfacl to modify.

Anatomy of an ACL

Read-only / Safe
$ getfacl /srv/data
getfacl: Removing leading / from absolute path names
# file: srv/data
# owner: root
# group: devs
user::rwx
user:alice:rw-
group::rwx
group:auditors:r--
mask::rwx
other::---

Illustrative output

The ACL entries:

EntryMeaning
user::Permissions for the file owner
user:NAME:Permissions for a specific named user
group::Permissions for the file group
group:NAME:Permissions for a specific named group
mask::The effective-rights ceiling for all non-owner entries
other::Permissions for everyone else (unchanged from standard mode)

Modifying ACLs with setfacl

Configuration changesetfacl -m
$ setfacl -m u:alice:rw /srv/data/project; setfacl -m g:auditors:r /srv/data/project; getfacl /srv/data/project
# file: srv/data/project
# owner: root
# group: devs
user::rwx
user:alice:rw-
group::rwx
group:auditors:r--
mask::rwx
other::---

Illustrative output

Read-only / Safels with ACL
$ ls -l /srv/data/project
drwxrwxr-+ 1 root devs 4096 Aug  9 11:11 /srv/data/project

Illustrative output

Default ACLs on directories

A directory can carry a default ACL that propagates to new files and subdirectories created within it:

Configuration changedefault ACL
$ setfacl -d -m u:alice:rw /srv/data/project; setfacl -d -m g:auditors:r /srv/data/project
...

Illustrative output

Default ACLs are how sysadmins give a whole project tree a consistent permission model without managing every individual file.

Recursive ACL operations

Configuration changesetfacl -R
$ setfacl -R -m u:alice:rw /srv/data; getfacl -R /srv/data | head -30
...

Illustrative output

Removing ACLs

Configuration changeremove ACLs
$ setfacl -x u:alice /srv/data; setfacl -x g:auditors /srv/data; setfacl -b /srv/data; ls -l /srv/data
drwxr-x--- 1 root devs 4096 Aug  9 11:11 /srv/data

Illustrative output

Compatibility and tooling notes

ConcernWhat to know
cp -p preserves ACLs; plain cp may or may notcp --preserve=all is the safe default for ACL-aware copies
tar and ACLsModern GNU tar preserves ACLs by default; some backup tools do not
rsync and ACLs-A or --acls enables preservation; without it, ACLs are lost
ACLs on NFSNFSv4 supports ACLs natively; NFSv3 does not
ACLs on SambaConfigurable; depends on the acl_xattr module
ACLs on backup mediaConfirm the backup tool handles them; otherwise restore loses ACLs

Knowledge check

Knowledge check · 3 questions

  1. Q1. What does the `+` at the end of an `ls -l` permission string indicate?

  2. Q2. Setting a named user ACL on a file without also adjusting the mask means the new entry may be ineffective.

  3. Q3. Which of the following statements about default ACLs are correct? Select all that apply.

Passing score: 75%. Answers are checked in this browser.