Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

getfacl / setfacl

Direct answer

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.

When to use this

Use it to read or change ACLs on files and directories.

First 30 seconds

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.

Operational verification

setfacl changes entries → mask recalculated → getfacl shows effective rights → kernel enforces them

Evidence · next step

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
Platform / version applicability
linux
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformlinux
Scope / prerequisiteUse it to read or change ACLs on files and directories.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

5 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

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 -a and losing ACLs.
Evidence references

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.

observation · 1
Key points

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.

Key checks
  • getfacl -R <dir> > acl.txt — back up ACLs
  • ls -l <path> — owner, group and mode
  • stat -c '%A %a %U:%G' <path> — symbolic and numeric mode with owner
  • namei -l <path> — permissions of every directory on the path
  • id <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:

  • -m adds or modifies entries, -x removes them and --set replaces the whole ACL.
  • -b removes all extended entries, and -k removes the default ACL.
  • -d applies the operation to the default ACL, and -R works recursively.
  • Entries are written u:name:perms, g:name:perms, m::perms and o::perms, with a d: prefix for default entries.
  • The mask is recalculated automatically as the union of the owning group and all named entries, unless -n is given or a mask is set explicitly.

Common operations

GoalCommand
Give bob read and write on one filesetfacl -m u:bob:rw file
Give a group read access to a treesetfacl -R -m g:auditors:rX /srv/reports
Make new files inherit the samesetfacl -R -d -m g:auditors:rX /srv/reports
Remove one entrysetfacl -x u:bob file
Remove all ACLs from a treesetfacl -R -b /srv/reports
Copy an ACL from one file to anothergetfacl a | setfacl --set-file=- b
Back up and restore all ACLsgetfacl -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.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

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.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

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
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor doclinux current

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%
Technical changelog & impact

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.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
Terminology layer

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.

Aliases that resolve here
getfacl setfacllinux acl commandsinspect acl linuxset posix acl
Embedded reference data

Quick lookup tables

getfacl / setfacl operational reference

Topic-specific lookup boundaries, proof limits and next-step Evidence for getfacl / setfacl.

Lookup boundaryTopic-specific referenceOperational use
Scope / effective stategetfacl 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 verificationPin 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 chainpre-change ACL capture → intended setfacl delta → filesystem ACL update → mask/effective permission recalculation → getfacl read-back → process identity match → workload resultTrace requested/configured state through effective state to the observed workload result.
Failure boundaryTool 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 evidenceCorrelated 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 resultUse this observation only for the specific claim it actually supports.
Evidence limitIt 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 checkContinue 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 boundarygetfacl / setfacl
Topic pathPermissions & Ownership → getfacl / setfacl
Runtime stategetfacl 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 chainpre-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 boundaryTool 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 ruleProve which configuration source owns the state, then prove that the running consumer loaded or generated the intended state.
Confirmation

Confirm action

Continue?