Use it when a user or service gets Permission denied.
Permission Denied
"Permission denied" (EACCES/EPERM) means the kernel refused an operation: file mode, ownership, ACL, a missing execute bit on a directory, a read-only or noexec mount, SELinux/AppArmor, or capabilities.
1. Which user? ps -o user= -p <pid> or the service's User=.
2. namei -l <path> — x on every directory?
3. ls -l / getfacl — mode and ACL.
4. Mount: findmnt -no OPTIONS <mount> (ro, noexec).
5. SELinux ausearch -m avc -ts recent / AppArmor journalctl -k | grep DENIED.
process with UID/GID → path walk (x on directories) → mode/ACL → mount options → SELinux/AppArmor → allowed
For Linux Troubleshooting → Permission Denied, continue with the first unproven Topic check: Capture exact failing syscall/path, process UID/GID/groups and namespace/context. If that boundary is healthy, advance to the adjacent check: Walk path-component execute permissions plus target owner/group/mode and ACL mask. 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
Healthy evidence: the exact process identity receives the intended kernel access decision after a minimal policy/ownership correction, with no unnecessary privilege expansion and the original operation succeeding.
Step 2 Verification and output interpretation Verify boundary
Existing fast checks for this Topic. - Capture exact failing syscall/path, process UID/GID/groups and namespace/context.
- Walk path-component execute permissions plus target owner/group/mode and ACL mask.
- Check mount flags, SELinux/AppArmor labels/denials and systemd/container sandbox controls.
- Apply the narrowest policy/ownership fix and repeat the same operation as the original identity.
Step 3 Commands Verify boundary
ls -l file ; namei -l /path/to/file
id user
getfacl file
ausearch -m AVC -ts recent
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: 777 is used as diagnosis, root success is considered evidence, only final file mode is inspected, or ACL mask/parent traversal/LSM/service sandboxing is skipped.
Step 5 Common mistakes Narrow the fault
- Fixing with 777 instead of finding the missing permission or SELinux label.
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.
Check as the actual user, along the whole path. If mode bits look right, check ACLs, mount options and the MAC framework (SELinux/AppArmor) logs.
journalctl -b -p err— errors this bootsystemctl --failed— failed unitsdf -h; df -i— space and inodesss -tulpn— listening socketsdmesg -T | tail— recent kernel messages
ReferenceWhat it is1 section · depth on demand
Core model
Evaluate access as the kernel does for the exact process and object. Resolve UID/GID and supplementary groups, every directory component, ACL/mode, mount and LSM policy, plus systemd/container restrictions; do not fix by broad chmod.
ReferenceImportant terms & boundaries4 sections · depth on demand
What this shows and what it does not
Permission Denied owns cross-layer access fault isolation; Users & Permissions and Linux Security own detailed DAC/ACL/LSM policy semantics.
In depth
Every directory on the path needs search (x) permission
The path_resolution manual states that if the process lacks search permission on a directory during lookup, the lookup fails with EACCES; for directories the execute bit means search. That is why a file with rw-r--r-- can still be unreadable:
$ namei -l /srv/app/data/config.yml
f: /srv/app/data/config.yml
drwxr-xr-x root root /
drwxr-xr-x root root srv
drwxr-x--- root appadm app
drwxr-xr-x app app data
-rw-r--r-- app app config.yml
/srv/app has no x for others, so a user outside group appadm cannot reach config.yml despite its permissions.
Layers to check, in order
| Layer | Command | Typical surprise |
|---|---|---|
| Identity | id <user>; for services systemctl show <unit> -p User -p Group -p SupplementaryGroups | Service runs as another user; new group membership needs a new login |
| Classic permissions on the whole path | namei -l <path> | Missing x on a parent |
| ACLs | getfacl <path> | Mask entry limits ACL rights |
| Attributes | lsattr <file> | i (immutable), a (append-only) — even root cannot write |
| Mount options | findmnt -T <path> | ro, noexec, nosuid, nodev |
| MAC | ausearch -m AVC -ts recent (SELinux) / journalctl -k \| grep DENIED (AppArmor) | Permissions fine, policy denies |
| systemd sandboxing | systemctl show <unit> -p ProtectSystem -p ProtectHome -p ReadWritePaths | Unit sees /home empty or /usr read-only |
| Capabilities | getpcap <pid> | Binding to ports < 1024 without CAP_NET_BIND_SERVICE |
Reproduce as the right user
sudo -u www-data test -r /srv/app/data/config.yml && echo readable
sudo -u www-data ls /srv/app/data/
Testing as root proves nothing — root bypasses classic permissions (but not MAC, immutable bits or read-only mounts).
noexec and scripts
Permission denied when running ./script.sh on a noexec mount (often /tmp) persists even with chmod +x; bash script.sh works because the shell reads the file — move the script instead of removing noexec.
*The namei listing uses a fictional directory tree to demonstrate traversal permissions, rather than an exported access report.*
How it works at runtime
Permission Denied is part of Linux Troubleshooting → Permission Denied. Permission Denied isolates Linux access failures across process credentials, path traversal, owner/group mode bits, ACLs, sudo transitions, mount options, SELinux/AppArmor and service sandboxing.
Topic-specific state model. Permission Denied isolates Linux access failures across process credentials, path traversal, owner/group mode bits, ACLs, sudo transitions, mount options, SELinux/AppArmor and service sandboxing.
Interpretation rule. - File mode alone ≠ effective access decision.
- Membership in a group ≠ current process/session has that supplementary group.
- sudo works ≠ the service or application identity has access.
- chmod 777 removes a symptom ≠ ownership, ACL, LSM or path policy is correct.
Method
"Permission denied" has several possible layers — check in order:
1. Mode bits and ownership on the file and every parent directory (x needed to traverse): namei -l /srv/app/data/file.
2. ACLs: getfacl.
3. Mount options: noexec, ro, nosuid (findmnt -T /path).
4. SELinux/AppArmor: ausearch -m AVC -ts recent, journalctl -k | grep DENIED.
5. Capabilities (binding ports < 1024 needs CAP_NET_BIND_SERVICE).
6. systemd sandboxing: ProtectHome, ProtectSystem, ReadWritePaths.
7. Immutable attribute: lsattr (i flag).
8. NFS root squash / ID mapping on network filesystems.
sudo -u appuser test -r /srv/app/data/file && echo readable
ReferenceConfiguration & state1 section · depth on demand
Configuration, persistence and lifecycle
Distribution/platform context. Permission Denied owns cross-layer access fault isolation; Users & Permissions and Linux Security own detailed DAC/ACL/LSM policy semantics.
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 Linux Troubleshooting → Permission Denied. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://docs.kernel.org/ · 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
Permission Denied operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for Permission Denied.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | Permission Denied isolates Linux access failures across process credentials, path traversal, owner/group mode bits, ACLs, sudo transitions, mount options, SELinux/AppArmor and service sandboxing. | Establish exactly what this Topic owns before crossing into another subsystem. |
| Fast verification | Pin symptom + exact time + host/boot/user → define scope + expected baseline → preserve original failing test → collect targeted kernel/process/service/storage/network/security/log evidence → identify first divergent boundary → make one minimal reversible change → repeat original test → verify adjacent regressions and retain before/after evidence. | Use the shortest evidence path first; a fast check is a boundary test, not blanket proof. |
| Verification chain | symptom + exact time → scope + baseline → reproduce original failure → collect first-party evidence → identify first failed boundary → minimal controlled change → repeat original test → regression/posture check | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | Permission Denied troubleshooting is complete only when evidence localizes the first failed Linux boundary and the original failing workload passes after the smallest justified change; intermediate command success is not final proof. | Stop broad troubleshooting at the first boundary that is not supported by evidence. |
| Positive evidence | Correlated Linux troubleshooting evidence can establish this proof path: symptom + exact time → scope + baseline → reproduce original failure → collect first-party evidence → identify first failed boundary → minimal controlled change → repeat original test → regression/posture check | Use this observation only for the specific claim it actually supports. |
| Evidence limit | It does not independently prove behavior outside the captured host, boot, process/user, dependency, time or workload scope. Permission Denied troubleshooting is complete only when evidence localizes the first failed Linux boundary and the original failing workload passes after the smallest justified change; intermediate command success is not final proof. | Do not promote a local success signal into end-to-end or adjacent-dependency proof. |
| Next troubleshooting check | Continue from the first unproven boundary: reproduce the exact original failure, collect the owning subsystem evidence at the same time, change only the proven cause or prerequisite, then repeat the original workload and regression checks. | Continue to the next unresolved boundary while preserving the original test condition. |
Permission Denied · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | Permission Denied |
|---|---|
| Topic path | Linux Troubleshooting → Permission Denied |
| Runtime state | Permission Denied isolates Linux access failures across process credentials, path traversal, owner/group mode bits, ACLs, sudo transitions, mount options, SELinux/AppArmor and service sandboxing. |
| Fast checks | - Capture exact failing syscall/path, process UID/GID/groups and namespace/context. - Walk path-component execute permissions plus target owner/group/mode and ACL mask. - Check mount flags, SELinux/AppArmor labels/denials and systemd/container sandbox controls. - Apply the narrowest policy/ownership fix and repeat the same operation as the original identity. |
| Verification chain | symptom + exact time → scope + baseline → reproduce original failure → collect first-party evidence → identify first failed boundary → minimal controlled change → repeat original test → regression/posture check 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 | Permission Denied troubleshooting is complete only when evidence localizes the first failed Linux boundary and the original failing workload passes after the smallest justified change; intermediate command success is not final proof. Boundary chain: process credentials/namespace → path/mount lookup → DAC/ACL/LSM → filesystem metadata → block/device/backend → completion/read-back. |
| Persistence rule | Prove which configuration source owns the state, then prove that the running consumer loaded or generated the intended state. |