Use it to read or change ACLs on files and directories.
getfacl / setfacl
getfacl shows a file's ACL; setfacl -m adds or changes entries, -x removes one, -b removes all, and -d sets default (inherited) entries on directories.
1. getfacl <path> — current entries.
2. Add: setfacl -m u:alice:rX <path>.
3. Recursive and default: setfacl -R -m g:team:rwX <dir> and setfacl -R -d -m g:team:rwX <dir>.
4. Remove: setfacl -x u:alice <path>.
5. Check the #effective: lines in getfacl.
setfacl changes entries → mask recalculated → getfacl shows effective rights → kernel enforces them
For Permissions & Ownership → getfacl / setfacl, continue with the first unproven Topic check: Capture pre-change ACL including access/default entries and mask. If that boundary is healthy, advance to the adjacent check: Use numeric IDs when names may resolve differently across hosts or identity sources. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.
Continue only after interpreting the current observation.Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational evidence path Verify boundary
pre-change ACL capture → intended setfacl delta → filesystem ACL update → mask/effective permission recalculation → getfacl read-back → process identity match → workload result
Healthy evidence: pre/post ACL evidence is preserved, mask and identities resolve correctly and the intended principal passes the original access test without unnecessary grants.
Step 2 Verification and output interpretation Verify boundary
Existing fast checks for this Topic. - Capture pre-change ACL including access/default entries and mask.
- Use numeric IDs when names may resolve differently across hosts or identity sources.
- Apply minimal ACL delta and read back the complete ACL/mask.
- Test the original operation as the intended principal and check newly created children separately for default ACL behavior.
Verification chain. pre-change ACL capture → intended setfacl delta → filesystem ACL update → mask/effective permission recalculation → getfacl read-back → process identity match → workload result
Step 3 Commands Verify boundary
getfacl -R /srv/project > acl-backup.txt
setfacl --restore=acl-backup.txt
setfacl -b file
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: ACL is edited without baseline capture, mask recalculation is overlooked, or tool success replaces principal-specific workload verification.
Step 5 Common mistakes Narrow the fault
- Copying files without
-aand losing ACLs.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
Use capital X so files do not become executable. Apply to existing trees with -R and set defaults with -d for new files. Back up ACLs with getfacl -R <dir> > acl.txt and restore with setfacl --restore=acl.txt.
getfacl -R <dir> > acl.txt— back up ACLsls -l <path>— owner, group and modestat -c '%A %a %U:%G' <path>— symbolic and numeric mode with ownernamei -l <path>— permissions of every directory on the pathid <user>— user's groups
ReferenceWhat it is1 section · depth on demand
Core model
Capture the original ACL first, preserve numeric identity when ambiguity matters, apply the smallest intended change, then read the ACL back and verify effective rights for the actual process. Be explicit about access versus default ACL and automatic mask recalculation because a syntactically successful setfacl operation can alter effective rights differently from the visible named entry.
ReferenceImportant terms & boundaries5 sections · depth on demand
What this shows and what it does not
Tool success shows the ACL operation was accepted, not that the effective masked permission or workload outcome matches intent.
In depth
Working with getfacl and setfacl
setfacl changes ACLs and getfacl shows them, in a format setfacl can read back. The setfacl(1) manual page documents the operations:
-madds or modifies entries,-xremoves them and--setreplaces the whole ACL.-bremoves all extended entries, and-kremoves the default ACL.-dapplies the operation to the default ACL, and-Rworks recursively.- Entries are written
u:name:perms,g:name:perms,m::permsando::perms, with ad:prefix for default entries. - The mask is recalculated automatically as the union of the owning group and all named entries, unless
-nis given or a mask is set explicitly.
Common operations
| Goal | Command |
|---|---|
| Give bob read and write on one file | setfacl -m u:bob:rw file |
| Give a group read access to a tree | setfacl -R -m g:auditors:rX /srv/reports |
| Make new files inherit the same | setfacl -R -d -m g:auditors:rX /srv/reports |
| Remove one entry | setfacl -x u:bob file |
| Remove all ACLs from a tree | setfacl -R -b /srv/reports |
| Copy an ACL from one file to another | getfacl a | setfacl --set-file=- b |
| Back up and restore all ACLs | getfacl -R -p /srv > acl.bak; setfacl --restore=acl.bak |
Access and default ACLs together
A shared directory usually needs both kinds. The access ACL governs what exists now, and the default ACL governs what will be created. Setting only the default leaves existing files unchanged, and setting only the access ACL leaves new files without the entries.
host$ sudo setfacl -R -m g:auditors:rX /srv/reports
host$ sudo setfacl -R -d -m g:auditors:rX /srv/reports
host$ getfacl -p /srv/reports
# file: /srv/reports
# owner: root
# group: reports
# flags: -s-
user::rwx
group::rwx
group:auditors:r-x
mask::rwx
other::---
default:user::rwx
default:group::rwx
default:group:auditors:r-x
default:mask::rwx
default:other::---
host$ sudo getfacl -R -p /srv/reports > /root/reports-acl-$(date +%F).txt
host$ sudo setfacl --restore=/root/reports-acl-2026-11-28.txt
ACLs and copying tools
Plain cp and many archive tools drop ACLs. Use cp -a, rsync -A, or tar --acls to keep them. A getfacl -R backup, like the one above, makes it possible to restore permissions after a careless recursive change.
Documented example, not captured output.
How it works at runtime
getfacl / setfacl is part of Permissions & Ownership → getfacl / setfacl. getfacl and setfacl are the canonical POSIX ACL inspection and modification tools used to read, add, remove, replace or copy access/default ACL entries; their output/change result must still be interpreted through ACL matching, mask and real workload behavior.
Topic-specific state model. getfacl and setfacl are the canonical POSIX ACL inspection and modification tools used to read, add, remove, replace or copy access/default ACL entries; their output/change result must still be interpreted through ACL matching, mask and real workload behavior.
Interpretation rule. - setfacl exit success ≠ intended effective permission.
- Named entry value ≠ effective value when mask limits it.
- Default ACL change ≠ retroactive change to existing children.
- Copied/restored ACL ≠ correct identity mapping on another host/filesystem.
Quick reference
Reading getfacl output:
# file: srv/finance
# owner: root
# group: finance
user::rwx
user:auditor:r-x
group::rwx
mask::r-x # effective cap for named users/groups and owning group
other::---
default:user::rwx
default:group:finance:rwx
Documented example, not captured output. With this mask, the group gets only r-x effectively (getfacl shows #effective:r-x). Raise the mask with setfacl -m m::rwx; note that chmod g=… on an ACL'd file changes the mask, not the group entry.
Limits and how it fails
Primary failure point. Tool success shows the ACL operation was accepted, not that the effective masked permission or workload outcome matches intent.
ReferenceConfiguration & state1 section · depth on demand
Configuration, persistence and lifecycle
Distribution/platform context. getfacl / setfacl owns ACL inspection/change workflow. ACL owns evaluation semantics; identity mapping and filesystem support remain separate concerns.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Permissions & Ownership → getfacl / setfacl. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.kernel.org/doc/man-pages/ · confidence 94%What changed and what may be affected
Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
getfacl / setfacl operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for getfacl / setfacl.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | getfacl and setfacl are the canonical POSIX ACL inspection and modification tools used to read, add, remove, replace or copy access/default ACL entries; their output/change result must still be interpreted through ACL matching, mask and real workload behavior. | Establish exactly what this Topic owns before crossing into another subsystem. |
| Fast verification | Pin the exact process/session → resolve user/group names to numeric UID/GID through the effective identity stack → capture effective UID/GID + supplementary groups → resolve every required path component and target inode → inspect numeric owner/group + mode + ACL/mask + special bits → capture sudo/privilege transition if present → account for non-DAC controls → repeat the original workload operation. | Use the shortest evidence path first; a fast check is a boundary test, not blanket proof. |
| Verification chain | pre-change ACL capture → intended setfacl delta → filesystem ACL update → mask/effective permission recalculation → getfacl read-back → process identity match → workload result | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | Tool success proves the ACL operation was accepted, not that the effective masked permission or workload outcome matches intent. | Stop broad troubleshooting at the first boundary that is not supported by evidence. |
| Positive evidence | Correlated Linux identity and authorization evidence can establish this proof path: pre-change ACL capture → intended setfacl delta → filesystem ACL update → mask/effective permission recalculation → getfacl read-back → process identity match → workload result | Use this observation only for the specific claim it actually supports. |
| Evidence limit | It does not independently prove behavior outside the captured identity source, process credential, filesystem object, DAC/ACL, privilege or workload scope. Tool success proves the ACL operation was accepted, not that the effective masked permission or workload outcome matches intent. | Do not promote a local success signal into end-to-end or adjacent-dependency proof. |
| Next troubleshooting check | Continue from the first unproven boundary: keep the same process/session, resolve numeric identity and groups, inspect each path component plus target ownership/mode/ACL/special bits, capture any privilege transition/non-DAC denial, then repeat the original operation before broadening permissions. | Continue to the next unresolved boundary while preserving the original test condition. |
getfacl / setfacl · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | getfacl / setfacl |
|---|---|
| Topic path | Permissions & Ownership → getfacl / setfacl |
| Runtime state | getfacl and setfacl are the canonical POSIX ACL inspection and modification tools used to read, add, remove, replace or copy access/default ACL entries; their output/change result must still be interpreted through ACL matching, mask and real workload behavior. |
| Fast checks | - Capture pre-change ACL including access/default entries and mask. - Use numeric IDs when names may resolve differently across hosts or identity sources. - Apply minimal ACL delta and read back the complete ACL/mask. - Test the original operation as the intended principal and check newly created children separately for default ACL behavior. |
| Verification chain | pre-change ACL capture → intended setfacl delta → filesystem ACL update → mask/effective permission recalculation → getfacl read-back → process identity match → workload result Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return path or regression → explicit Evidence boundary. |
| Failure boundary | Tool success proves the ACL operation was accepted, not that the effective masked permission or workload outcome matches intent. Boundary chain: process/socket namespace → source/rule/FIB → neighbor → netfilter/eBPF/qdisc → virtual/physical device → peer → return → application. |
| Persistence rule | Prove which configuration source owns the state, then prove that the running consumer loaded or generated the intended state. |