Use it when a user or service gets "Permission denied", or when setting access to shared files.
Permissions & Ownership
Every file has an owner, a group and permission bits for owner, group and others: read (r), write (w) and execute (x). For directories, x means "may enter", r "may list" and w "may create and delete names".
1. id <user> — which groups does the user really have (new groups need a new login)?
2. namei -l <path> — execute (x) on every parent directory?
3. ls -l <path> — owner, group and the matching permission bits?
4. ACLs (+ in ls -l) → getfacl <path>; SELinux/AppArmor → check the audit log.
5. Fix with the least access needed, then test as that user: sudo -u <user> <cmd>.
user identified → owner / group / other class chosen → x on every parent directory → r/w/x bit for the operation → ACL and MAC checks → access
For Permissions & Ownership, continue with the first unproven Topic check: Capture effective UID/GID and supplementary groups of the real process. If that boundary is healthy, advance to the adjacent check: Inspect numeric owner/group, mode and ACL on the target plus required parent directories. 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.
chmodPrimary Commands
Configuration and operational commands for this Topic.
chmodReferenceChange discretionary permission mode bits on files or directories.
Use when: Primary lookup intent: configure. Use chmod when the lookup goal is to change discretionary permission mode bits on files or directories. Tie the result to the same host, namespace, user identity and time window as the symptom.
Quick note: Post-change verification for chmod: Read back mode/ACL state and rerun the original access test under the effective identity. Output review: healthy and suspicious cues are command-specific interpretation boundaries, not fixed literal output samples. Intent class: configure. Safety class: changes_state. Intent describes the primary lookup role; safety remains command-family capability and can be higher than a read-only invocation. chmod is documented as an operational lookup primitive under Permissions & Ownership. The canonical leaf intentionally represents the command family; options remain distribution/tool-version specific.
chownReferenceChange file or directory ownership and optionally the owning group.
Use when: Primary lookup intent: configure. Use chown when the lookup goal is to change file or directory ownership and optionally the owning group. Tie the result to the same host, namespace, user identity and time window as the symptom.
Quick note: Post-change verification for chown: Verify numeric ownership/ACLs and rerun the workload as the effective service/user identity. Output review: healthy and suspicious cues are command-specific interpretation boundaries, not fixed literal output samples. Intent class: configure. Safety class: changes_state. Intent describes the primary lookup role; safety remains command-family capability and can be higher than a read-only invocation. chown is documented as an operational lookup primitive under Permissions & Ownership. The canonical leaf intentionally represents the command family; options remain distribution/tool-version specific.
chgrpReferenceChange the owning group of filesystem objects.
Use when: Primary lookup intent: configure. Use chgrp when the lookup goal is to change the owning group of filesystem objects. Tie the result to the same host, namespace, user identity and time window as the symptom.
Quick note: Post-change verification for chgrp: Read back ownership/ACLs and repeat access as the intended service or user identity. Output review: healthy and suspicious cues are command-specific interpretation boundaries, not fixed literal output samples. Intent class: configure. Safety class: changes_state. Intent describes the primary lookup role; safety remains command-family capability and can be higher than a read-only invocation. chgrp is documented as an operational lookup primitive under Permissions & Ownership. The canonical leaf intentionally represents the command family; options remain distribution/tool-version specific.
umaskReferenceDisplay or set the shell mask that removes default permission bits from newly created objects.
Use when: Primary lookup intent: configure. Use umask when the lookup goal is to display or set the shell mask that removes default permission bits from newly created objects. Tie the result to the same host, namespace, user identity and time window as the symptom.
Quick note: Post-change verification for umask: Read back umask and create a controlled test object to verify resulting permissions for the intended process. Output review: healthy and suspicious cues are command-specific interpretation boundaries, not fixed literal output samples. Intent class: configure. Safety class: changes_state. Intent describes the primary lookup role; safety remains command-family capability and can be higher than a read-only invocation. umask is documented as an operational lookup primitive under Permissions & Ownership. The canonical leaf intentionally represents the command family; options remain distribution/tool-version specific.
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
process effective UID/GID/groups → pathname traversal directories → target inode owner/group → POSIX ACL/mask or owner-group-other mode → special bits + non-DAC constraints → kernel access decision → workload result
Healthy evidence: effective process credentials, directory traversal, target owner/group, mode/ACL and special bits all align with the intended access and the original operation succeeds.
Step 2 Commands Verify boundary
ls -l file
stat -c '%A %U:%G %n' file
chmod 640 file
chown root:www-data file
Step 3 Verification and output interpretation Verify boundary
Verification path. Verify numeric identity and the exact credentials of the failing process, not only the account database. Inspect ownership/mode/ACL information on every relevant path component and validate sudo policy using the invoking identity and command context. For session changes, show whether the process predates the group/policy update. A controlled access test under the same user, groups, cwd and environment is stronger than reading policy files in isolation.
Existing fast checks for this Topic. - Capture effective UID/GID and supplementary groups of the real process.
- Inspect numeric owner/group, mode and ACL on the target plus required parent directories.
- Account for ACL mask, SUID/SGID/sticky behavior and mount/security policy where relevant.
- Repeat the exact read/write/execute/create/delete workload operation.
Verification chain. process effective UID/GID/groups → pathname traversal directories → target inode owner/group → POSIX ACL/mask or owner-group-other mode → special bits + non-DAC constraints → kernel access decision → workload result
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: only the final file is inspected, ACL masks are ignored, directory execute semantics are misunderstood, or chmod/chown is applied before identifying the first failing step.
It does not show behavior outside the captured identity source, process credential, filesystem object, DAC/ACL, privilege or workload scope. DAC evidence explains classic filesystem access within the examined path and process credentials, but it does not show LSM, mount, capability, immutable or application authorization layers.
Next check: Continue from the first step that has not been verified: 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.
Step 5 Common mistakes Narrow the fault
chmod -R 777to fix access problems.- Forgetting directory execute permission is needed to enter it.
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.
Subtopics
Go one level deeper into this subject.
Numeric permissions express the owner/group/other rwx bit triplets as octal values, typically one digit per class with an optional leading special-bit digit; they are a compact representation of inode mode bits, not a complete access decision.
Subtopic Symbolic PermissionsSymbolic permissions describe mode changes and displays using user/group/other/all classes with read/write/execute and special-mode symbols, making intent readable while still representing only part of the final Linux authorization decision.
Subtopic SUIDSUID is the set-user-ID mode bit on an executable file that can cause a successful exec to adopt the file owner as effective user identity, subject to kernel, filesystem, mount and security constraints; it is a privilege-transition mechanism rather than a generic read/write permission.
Subtopic SGIDSGID is the set-group-ID bit with two major Linux filesystem roles: on executable files it can select the file group as effective group at exec, while on directories it commonly causes new entries to inherit the directory group and supports collaborative group ownership.
Subtopic Sticky BitSticky Bit on a writable directory restricts removal or rename of contained entries so users generally cannot delete or rename another user’s files merely because the directory is writable; the canonical shared-space example is /tmp.
Subtopic ACLPOSIX ACLs extend classic owner/group/other mode permissions with named user and group entries plus a mask that limits effective permissions for named users, named groups and the owning group class.
Subtopic getfacl / setfaclgetfacl 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.
The kernel checks owner first, then group, then others — only the first matching class counts. Every directory on the path needs x. root bypasses most checks; services run as their own user. Beyond mode bits, ACLs, SELinux/AppArmor and mount options (ro, noexec) can still deny access.
ls -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 process effective identity and supplementary groups, then inspect the final target object and every directory needed for pathname traversal. Evaluate ACLs and masks when present before falling back to classic mode classes. Separate read/write/execute semantics by object type, and verify the original operation because a single permissive bit does not show the whole path or workload.
ReferenceImportant terms & boundaries6 sections · depth on demand
What this shows and what it does not
DAC evidence explains classic filesystem access within the examined path and process credentials, but it does not show LSM, mount, capability, immutable or application authorization layers.
In depth
The Linux permission model in one view
Every file has an owner, a group and twelve mode bits. The inode(7) manual page lists them:
- three special bits: set-user-ID (04000), set-group-ID (02000) and sticky (01000);
- three permission bits (read, write, execute) for each of owner (00700), group (00070) and others (00007).
ACLs can add entries for further users and groups. umask decides the default bits for new files.
What r, w and x mean
| Bit | On a file | On a directory |
|---|---|---|
| r | Read the contents | List the names in it |
| w | Change the contents | Create, delete and rename entries (with x) |
| x | Execute it | Enter it and access entries by name |
How access is decided
1. If you're the owner, only the owner bits count, even if the group bits would allow more.
2. Otherwise, if you're in the file's group (or a matching ACL entry), the group bits or ACL count, limited by the ACL mask.
3. Otherwise, the "other" bits count.
root bypasses most of these checks, except that execution needs at least one x bit.
Tools
| Task | Command |
|---|---|
| Show mode, owner and group | ls -l, stat -c '%A %a %U:%G %n' |
| Change mode | chmod |
| Change owner and group | chown user:group, chgrp |
| Default for new files | umask |
| Extra users and groups | setfacl, getfacl |
host$ stat -c '%A %a %U:%G %n' /srv/reports /srv/reports/q4.csv /usr/bin/passwd /tmp
drwxrws--- 2770 root:reports /srv/reports
-rw-rw---- 660 alice:reports /srv/reports/q4.csv
-rwsr-xr-x 4755 root:root /usr/bin/passwd
drwxrwxrwt 1777 root:root /tmp
host$ namei -l /srv/reports/q4.csv
f: /srv/reports/q4.csv
drwxr-xr-x root root /
drwxr-xr-x root root srv
drwxrws--- root reports reports
-rw-rw---- alice reports q4.csv
host$ sudo -u bob cat /srv/reports/q4.csv
cat: /srv/reports/q4.csv: Permission denied
namei for "Permission denied"
Access requires x on every directory in the path, not just the right bits on the file. namei -l shows the permissions of each path component. It usually reveals the one directory that blocks access, which is why bob is refused here.
Documented example, not captured output.
Platform, version and operating-envelope scope
Standard Unix permissions behave the same on all Linux distributions; POSIX ACL support, default umask, user private groups and SELinux/AppArmor labels vary by distribution, filesystem and mount options.
How it works at runtime
Permissions & Ownership is part of Permissions & Ownership. Permissions & Ownership defines Linux discretionary filesystem authorization from inode owner UID, group GID, owner/group/other mode bits, special mode bits and POSIX ACLs, evaluated against the process credentials while remaining distinct from LSM, mount and application-level policy.
Runtime state ownership and mechanics. Linux authorization combines numeric UID/GID identity, supplementary groups, discretionary mode bits, ACLs, capabilities, sudo/PAM policy and optional LSM enforcement. Name-service databases map names to numeric identities, but the kernel authorizes using numeric credentials attached to the process. Effective, real and saved IDs can differ, and group membership is normally established when the session is created rather than re-read for every filesystem operation.
Topic-specific state model. Permissions & Ownership defines Linux discretionary filesystem authorization from inode owner UID, group GID, owner/group/other mode bits, special mode bits and POSIX ACLs, evaluated against the process credentials while remaining distinct from LSM, mount and application-level policy.
Interpretation rule. - File permission bits ≠ directory permission semantics.
- Target file mode ≠ complete path access; parent-directory traversal/search also matters.
- Mode bits ≠ complete authorization when POSIX ACLs or non-DAC controls apply.
- Ownership or chmod success ≠ application operation success.
Quick reference
Linux permission evaluation for a file access:
1. root (CAP_DAC_OVERRIDE) bypasses read/write checks (execute needs at least one x bit).
2. If the process UID owns the file → owner bits.
3. Else if a named user ACL entry matches → that entry (masked).
4. Else if any of the process groups match the file group or named group ACLs → group/ACL bits (masked).
5. Else → other bits.
6. MAC (SELinux/AppArmor) can still deny afterwards.
Only the first matching class counts: an owner with --- is denied even if "other" has rwx.
namei -l /srv/app/data/report.csv # permissions along the whole path
Limits and how it fails
Primary failure point. DAC evidence explains classic filesystem access within the examined path and process credentials, but it does not show LSM, mount, capability, immutable or application authorization layers.
Model. A username is a mapping, while kernel authorization uses numeric credentials. Mode 0777 does not bypass SELinux/AppArmor, mount flags or application policy. Membership listed in /etc/group does not show an existing process has that supplementary group. sudo authorization is not the same as shell root login, and root can still be constrained by namespaces, read-only mounts, immutable attributes or LSM rules. Keep authentication, identity and authorization separate.
ReferenceConfiguration & state1 section · depth on demand
Configuration, persistence and lifecycle
User/group changes may require a new login/session before supplementary credentials change. Permission changes should preserve least privilege and account for ACL masks, setuid/setgid semantics, sticky directories, file capabilities and LSM labels where applicable.
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. 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
Permissions & Ownership operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for Permissions & Ownership.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | Permissions & Ownership defines Linux discretionary filesystem authorization from inode owner UID, group GID, owner/group/other mode bits, special mode bits and POSIX ACLs, evaluated against the process credentials while remaining distinct from LSM, mount and application-level policy. | 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 | process effective UID/GID/groups → pathname traversal directories → target inode owner/group → POSIX ACL/mask or owner-group-other mode → special bits + non-DAC constraints → kernel access decision → workload result | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | DAC evidence explains classic filesystem access within the examined path and process credentials; it does not independently prove LSM, mount, capability, immutable or application authorization layers. | 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: process effective UID/GID/groups → pathname traversal directories → target inode owner/group → POSIX ACL/mask or owner-group-other mode → special bits + non-DAC constraints → kernel access decision → 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. DAC evidence explains classic filesystem access within the examined path and process credentials; it does not independently prove LSM, mount, capability, immutable or application authorization layers. | 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. |
Permissions & Ownership · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | Permissions & Ownership |
|---|---|
| Topic path | Permissions & Ownership |
| Runtime state | Permissions & Ownership defines Linux discretionary filesystem authorization from inode owner UID, group GID, owner/group/other mode bits, special mode bits and POSIX ACLs, evaluated against the process credentials while remaining distinct from LSM, mount and application-level policy. |
| Fast checks | - Capture effective UID/GID and supplementary groups of the real process. - Inspect numeric owner/group, mode and ACL on the target plus required parent directories. - Account for ACL mask, SUID/SGID/sticky behavior and mount/security policy where relevant. - Repeat the exact read/write/execute/create/delete workload operation. |
| Verification chain | process effective UID/GID/groups → pathname traversal directories → target inode owner/group → POSIX ACL/mask or owner-group-other mode → special bits + non-DAC constraints → kernel access decision → 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 | DAC evidence explains classic filesystem access within the examined path and process credentials; it does not independently prove LSM, mount, capability, immutable or application authorization layers. 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. |