Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

File Permissions

Direct answer

File permissions are the base access control on Linux: owner/group/other mode bits, special bits (SUID/SGID/sticky) and default umask.

When to use this

Use it when auditing sensitive files or tightening access.

First 30 seconds

1. World-writable: find / -xdev -type f -perm -0002 -ls.

2. SUID/SGID: find / -xdev -perm /6000 -type f.

3. Sensitive files' modes: stat -c '%a %U:%G %n' /etc/shadow /etc/sudoers.

4. umask: umask (022 or stricter).

5. Fix and record exceptions.

Operational verification

mode bits and ownership → kernel checks on every access → audit finds deviations

Evidence · next step

For Security → File Permissions, continue with the first unproven Topic check: Record exact host, distribution/kernel, boot ID, time window, workload, identity and the authoritative configuration/policy source for File Permissions. If that boundary is healthy, advance to the adjacent check: Read back the effective runtime state and precedence rather than assuming an edited file, package state or service status is active. 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 when auditing sensitive files or tightening access.
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

process credentials → mount namespace/path traversal → inode owner/group → rwx/special bits → ACL/LSM/mount checks → filesystem operation → workload result

Healthy evidence: numeric identities, path traversal and mode semantics match intent and allowed/denied operations succeed or fail exactly as expected

Step 2 Verification and output interpretation Verify boundary

Verification chain. process credentials → mount namespace/path traversal → inode owner/group → rwx/special bits → ACL/LSM/mount checks → filesystem operation → workload result

Step 3 Commands Verify boundary
find / -xdev -perm -0002 -type f 2>/dev/null | head
find /home -perm -o+w
Step 4 Failure modes and next checks Narrow the fault

Suspicious evidence: stale group membership, missing execute on parent, overly broad group/world bits, special-bit surprise, mount/ACL/LSM override or service identity mismatch explains access drift

Step 5 Common mistakes Narrow the fault
  • World-writable files outside /tmp.
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

Check sensitive files: /etc/shadow (0640 or 0000), private keys (600), sudoers (440). Find world-writable files and unexpected SUID binaries regularly.

Key checks
  • sestatus / aa-status — SELinux or AppArmor state
  • ss -tulpn — listening services
  • journalctl -u sshd -g 'Failed' — failed logins
  • ausearch -m avc,user_login -ts today — audit events (auditd)
ReferenceImportant terms & boundaries6 sections · depth on demand

What this shows and what it does not

The permissions boundary is confirmed only by effective access for the real identity along the full path; metadata alone does not show application access or broader security.

In depth

Finding risky file permissions

Security reviews on Linux always include a search for permissions that let the wrong users read or change files. The inode(7) manual page defines the bits involved: set-user-ID (04000), set-group-ID (02000), sticky (01000), and read, write and execute for owner, group and others. The patterns worth searching for follow from those bits.

What to look for

FindingRiskSearch
World-writable filesAnyone can change themfind / -xdev -type f -perm -0002
World-writable directories without the sticky bitAnyone can delete or replace filesfind / -xdev -type d -perm -0002 ! -perm -1000
Unexpected SUID or SGID filesPrivilege escalationfind / -xdev \( -perm -4000 -o -perm -2000 \) -type f
Files with no ownerLeft over from deleted users; may be claimed by a new UIDfind / -xdev -nouser -o -nogroup
Readable secretsKeys, passwords, tokens exposedfind /etc /opt /srv -name '*.key' -perm /044
Writable scripts run by rootCode execution as rootcron and systemd ExecStart= targets writable by others
Writable directories in root's PATHCommand hijackingls -ld $(echo $PATH | tr : ' ')

Files that should be strict

FileExpected
/etc/shadow, /etc/gshadow640 or 600, root (group shadow)
/etc/ssh/ssh_host_*_key600 root
/etc/sudoers, /etc/sudoers.d/*440 root
~/.ssh / authorized_keys700 / 600, owned by the user
Application secrets (.env, *.key)600 or 640 with the service group
/etc/crontab, /etc/cron.d/*600 or 644 root, not writable by others

Turning findings into baselines

Run the searches regularly and compare them with a saved baseline. A diff shows new SUID binaries or new world-writable files immediately. Tools such as AIDE or Lynis automate this, and configuration management can enforce the expected modes.

host$ sudo find / -xdev -type f -perm -0002 2>/dev/null | grep -vE "^/proc|^/sys" | head
/srv/app/config/settings.ini
host$ sudo find / -xdev -type d -perm -0002 ! -perm -1000 2>/dev/null | head
/srv/upload
host$ for f in $(sudo systemctl show -p ExecStart --value '*.service' 2>/dev/null | grep -o 'path=[^ ;]*' | cut -d= -f2 | sort -u); do [ -n "$(find "$f" -perm /022 2>/dev/null)" ] && ls -l "$f"; done
-rwxrwxr-x 1 deploy deploy 2048 Nov 20 09:14 /opt/app/bin/start
host$ sudo chmod 640 /srv/app/config/settings.ini && sudo chmod 1770 /srv/upload
host$ sudo stat -c '%a %U:%G %n' /etc/shadow /etc/sudoers /etc/ssh/ssh_host_ed25519_key

Reading the service check

The loop lists executables of systemd services that group or others can write. /opt/app/bin/start is group-writable by deploy. If the service runs as root, any member of that group can get root by editing the file. Remove the group write bit, or run the service as an unprivileged user.

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.

Known-good, transitional and broken reference

File Permissions — comparative operational reference for Security → File Permissions. What it does not show: systemd active/running or host-global state alone does not show the workload context is healthy Next check: move one step toward the original workload using Inspect the path and mount in the process namespace, effective UID/GID/ACL/LSM decision, filesystem/inode state and backend errors, then repeat the original file operation.

How it works at runtime

File Permissions is part of Security → File Permissions. File Permissions covers Linux DAC decisions from process UID/GIDs and pathname traversal through inode ownership and rwx/special mode semantics, with effective access verified as the real workload identity.

Topic-specific state model. File Permissions covers Linux DAC decisions from process UID/GIDs and pathname traversal through inode ownership and rwx/special mode semantics, with effective access verified as the real workload identity.

Interpretation rule. - Mode bits on the target file ≠ effective access when parent traversal, ACLs, mounts or LSMs differ.

  • Root ownership ≠ safe permissions or least privilege.

Quick reference

Permission hygiene on servers:

find / -xdev -type f -perm -0002 -ls 2>/dev/null        # world-writable files
find / -xdev -type d -perm -0002 ! -perm -1000 -ls      # world-writable dirs without sticky bit
find / -xdev \( -perm -4000 -o -perm -2000 \) -type f -ls   # SUID/SGID binaries
find / -xdev -nouser -o -nogroup 2>/dev/null           # orphaned files
stat -c '%a %U:%G %n' /etc/shadow /etc/sudoers

Expected: /etc/shadow 000 or 640 root:shadow, /etc/sudoers 440, home directories 700/750, private keys 600. Default umask 027 for services keeps new files from being world-readable.

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. The permissions boundary is confirmed only by effective access for the real identity along the full path; metadata alone does not show application access or broader security.

ReferenceConfiguration & state1 section · depth on demand

Configuration, persistence and lifecycle

Distribution/platform context. File Permissions owns DAC mode semantics; ACL owns extended ACL evaluation and SELinux/AppArmor own mandatory controls.

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 Security → File Permissions. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://docs.kernel.org/security/index.html · 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
linux file permissionsunix permissions securityrwx permissions
Embedded reference data

Quick lookup tables

File Permissions operational reference

Topic-specific lookup boundaries, proof limits and next-step Evidence for File Permissions.

Lookup boundaryTopic-specific referenceOperational use
Scope / effective stateFile Permissions covers Linux DAC decisions from process UID/GIDs and pathname traversal through inode ownership and rwx/special mode semantics, with effective access verified as the real workload identity.Establish exactly what this Topic owns before crossing into another subsystem.
Fast verificationPin host + boot/time + real identity/workload → identify authoritative policy/key/trust source → read back loaded/effective runtime state → reproduce one safe allow/deny/handshake test → correlate audit/service/kernel evidence → locate first failed boundary → make the smallest persistent change → repeat original workload + regression/recovery check.Use the shortest evidence path first; a fast check is a boundary test, not blanket proof.
Verification chainprocess credentials → mount namespace/path traversal → inode owner/group → rwx/special bits → ACL/LSM/mount checks → filesystem operation → workload resultTrace requested/configured state through effective state to the observed workload result.
Failure boundaryThe permissions boundary is proven only by effective access for the real identity along the full path; metadata alone does not prove application access or broader security.Stop broad troubleshooting at the first boundary that is not supported by evidence.
Positive evidenceCorrelated Linux security/trust evidence can establish this proof path: process credentials → mount namespace/path traversal → inode owner/group → rwx/special bits → ACL/LSM/mount checks → filesystem operation → workload resultUse this observation only for the specific claim it actually supports.
Evidence limitIt does not independently prove unobserved identities, objects, policies, namespaces, endpoints or time periods. The permissions boundary is proven only by effective access for the real identity along the full path; metadata alone does not prove application access or broader security.Do not promote a local success signal into end-to-end or adjacent-dependency proof.
Next troubleshooting checkContinue from the first unproven security/trust boundary, capture the adjacent effective state and audit/handshake evidence, make only the demonstrated persistent change, then repeat the original workload plus recovery/regression checks.Continue to the next unresolved boundary while preserving the original test condition.

File Permissions · operational reference

Compact Linux state, persistence, verification and boundary reference for fast lookup.

Reference boundaryFile Permissions
Topic pathSecurity → File Permissions
Runtime stateFile Permissions covers Linux DAC decisions from process UID/GIDs and pathname traversal through inode ownership and rwx/special mode semantics, with effective access verified as the real workload identity.
Fast checks- Record exact host, distribution/kernel, boot ID, time window, workload, identity and the authoritative configuration/policy source for File Permissions. - Read back the effective runtime state and precedence rather than assuming an edited file, package state or service status is active. - Reproduce one safe allowed/denied or handshake/access test and correlate kernel/service/audit evidence at the first relevant boundary. - Apply the smallest persistent cause-specific change, then repeat the original test plus an adjacent regression/recovery check.
Verification chainprocess credentials → mount namespace/path traversal → inode owner/group → rwx/special bits → ACL/LSM/mount checks → filesystem operation → 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 boundaryThe permissions boundary is proven only by effective access for the real identity along the full path; metadata alone does not prove application access or broader security. Boundary chain: process credentials/namespace → path/mount lookup → DAC/ACL/LSM → filesystem metadata → block/device/backend → completion/read-back.
Persistence ruleProve which configuration source owns the state, then prove that the running consumer loaded or generated the intended state.
Confirmation

Confirm action

Continue?