// learn Β· linux Β· rhcsa Β· 9 min

Access Control Lists (ACLs).

Standard permissions give you exactly three slots: owner, group, other. ACLs add as many named-user and named-group rules as you need β€” fine-grained access without inventing extra groups. Learn getfacl, setfacl, the mask, and the default ACLs that new files inherit.

Linux POSIX ACLs animated tutorial. getfacl, setfacl, named user and group entries, the ACL mask, default ACLs on directories, and the + indicator in ls -l. RHCSA EX200 ready.
// access control lists

When owner / group / other runs out of slots, ACLs let you attach as many per-user and per-group rules to a file as you need.

// before you start
you should know
  • Β·Solid on standard rwx permissions (the special-permissions lesson)
  • Β·Know what users and groups are
  • Β·Comfortable reading ls -l output
by the end you'll

Read an ACL with getfacl, add named user/group entries with setfacl, understand the mask, and set inheritable default ACLs on directories.

pace: 9 minutes

file ACL β€” step 1 / 6 Β· the ugo limit
$getfacl report.txt
# file: report.txt
# owner: alice # group: devs
user::rw-owner (alice)
group::r--owning group
other::---everyone else

Three slots is not enough

Standard Unix permissions give you exactly three sets of rwx: the owner, ONE group, and everyone else. But what if bob needs read-only and the devs group needs full access to the SAME file, and neither is the owner? You'd have to keep inventing groups. ACLs (Access Control Lists) let you attach as many named-user and named-group rules to a file as you need.

// key insight

The base permissions are ACL entries β€” ACLs just let you add more. Two gotchas that catch everyone: the + in ls -l means "there's an ACL here, run getfacl", and once an ACL exists, ls -l's group column shows the mask, not the owning group's real permission.

// exam-ready Β· getfacl / setfacl
$getfacl FILE
$setfacl -m u:bob:r FILE
$setfacl -m g:devs:rwx FILE
$setfacl -m m::r FILE
$setfacl -x u:bob FILE
$setfacl -b FILE
$setfacl -k DIR
$setfacl -d -m g:devs:rwx DIR
$setfacl -R -m g:devs:rX DIR
$setfacl --restore=acl.bak
$getfacl -R DIR > acl.bak
$cp -a / rsync -A
$ls -l β†’ trailing +
$#effective: in getfacl
$u:: g:: o::
$mount -o acl (older fs)
// check yourself
4 quick questions
Q1

bob (not the owner, not in the group) needs read access to one file, and you don't want to change any group memberships. What's the cleanest fix?

Q2

You see `-rw-rwxr--+ 1 alice devs` in ls -l. What does the + mean, and what is the 'rwx' middle field actually showing?

Q3

What does the ACL mask do?

Q4

You want every new file created under /srv/project to automatically grant the devs group rwx. What do you set?

These aren't graded β€” they're just for active recall, which is what actually makes the lesson stick.

πŸ”‘
// the foundation

chmod calculator

ACLs build on standard rwx β€” the base entries ARE your chmod permissions. Solidify octal vs symbolic here first.

open β†’

Read this lesson as text6 chapters Β· quiz answers

  1. 01Three slots is not enough

    Standard Unix permissions give you exactly three sets of rwx: the owner, ONE group, and everyone else. But what if bob needs read-only and the devs group needs full access to the SAME file, and neither is the owner? You'd have to keep inventing groups. ACLs (Access Control Lists) let you attach as many named-user and named-group rules to a file as you need.

  2. 02getfacl β€” read the ACL

    getfacl <file> prints the ACL. Even a file with no special ACL has three base entries that mirror the normal permissions: user:: (owner), group:: (owning group), other::. So ACLs aren't a separate system bolted on β€” the standard permissions ARE ACL entries. ls -l just shows them in the familiar rwxrwxrwx form.

    • $ getfacl report.txt β€” show the full ACL
    • $ ls -l report.txt β€” same base perms, compact form
  3. 03setfacl -m u: β€” grant a named user

    setfacl -m u:bob:r report.txt adds a rule: bob (who isn't the owner and may not be in the group) gets read access. -m means modify/add. Now ls -l shows a + after the permissions to signal 'there's an ACL here'. This is the whole point: per-user access without touching group membership.

    • $ setfacl -m u:bob:r report.txt β€” bob gets read
    • $ ls -l report.txt β€” note the trailing +
  4. 04setfacl -m g: β€” grant a named group

    Same idea for groups: setfacl -m g:devs:rwx report.txt gives the devs group full access β€” without making devs the owning group. You can stack as many named-user and named-group entries as you like. Each is one line in getfacl output.

    • $ setfacl -m g:devs:rwx report.txt β€” devs group gets rwx
    • $ setfacl -m u:bob:r,g:qa:r f.txt β€” multiple entries at once
  5. 05The mask β€” the effective-permission ceiling

    The moment you add a named entry, a mask:: entry appears. The mask is the MAXIMUM effective permission for all named users and the owning group β€” the rule's perms are ANDed with the mask. So even though devs has rwx, if the mask is r--, their effective permission is r--. setfacl recalculates the mask automatically; getfacl shows '#effective:' next to any entry the mask is clamping. ls -l's group field actually shows the MASK, not the owning group β€” a classic gotcha.

    • $ setfacl -m m::r report.txt β€” set the mask explicitly
    • $ getfacl report.txt β€” see #effective: notes
  6. 06Default ACLs β€” inheritance on directories

    On a DIRECTORY you can set a 'default' ACL with -d. It doesn't affect the directory itself β€” it's the template that every NEW file or subdirectory created inside inherits. Perfect for shared project folders: set a default ACL once and everything created there automatically grants the right access. Remove a single entry with -x, wipe the whole ACL with -b.

    • $ setfacl -d -m g:devs:rwx /srv/project β€” default ACL on the dir
    • $ setfacl -x g:devs report.txt β€” remove one entry
    • $ setfacl -b report.txt β€” strip ALL ACL entries
    • $ setfacl -R -m g:devs:rX /srv/project β€” recursive (X = dir-only x)

Quiz β€” answers

bob (not the owner, not in the group) needs read access to one file, and you don't want to change any group memberships. What's the cleanest fix?
β†’setfacl -m u:bob:r file β€” a named-user ACL entry.ACLs exist precisely for this: per-user access without inventing groups or loosening permissions for everyone. A named-user entry grants bob read and leaves everyone else unchanged.
You see -rw-rwxr--+ 1 alice devs in ls -l. What does the + mean, and what is the 'rwx' middle field actually showing?
β†’+ means there's an ACL on the file; the middle (group) field actually shows the ACL MASK, not the owning group's literal permission.The + flags the presence of an ACL. Once an ACL exists, ls -l's group triad shows the mask (the effective-permission ceiling), which is why it can look different from getfacl's group:: line. This trips people up constantly.
What does the ACL mask do?
β†’Sets the MAXIMUM effective permission for named users and the owning group β€” each entry's perms are ANDed with the mask.The mask is a ceiling. Even if devs has rwx, a mask of r-- clamps their effective access to r--. setfacl usually recalculates it for you; getfacl marks clamped entries with #effective:.
You want every new file created under /srv/project to automatically grant the devs group rwx. What do you set?
β†’setfacl -d -m g:devs:rwx /srv/project (a DEFAULT ACL on the dir).The -d (default) ACL is the inheritance template applied to newly created files and subdirectories. A regular ACL on the directory controls access to the directory itself, not what's created inside it. (SGID on the dir handles group OWNERSHIP; default ACLs handle inherited PERMISSIONS.)
// more in linux

keep going β€” these pair well with what you just learned.

see all linux β†’

See also

special permission bitsall lessons