Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

SUID

Direct answer

SUID (set-user-ID, mode 4xxx, s in the owner execute position) makes a program run with its file owner's privileges — e.g. /usr/bin/passwd runs as root to update /etc/shadow.

When to use this

Use it to understand privilege escalation by programs, and when auditing systems for risky SUID files.

First 30 seconds

1. List: find / -xdev -perm -4000 -type f -ls.

2. Compare with the distribution's expected list (package-owned? dpkg -S / rpm -qf).

3. Unknown or locally added → investigate; remove with chmod u-s.

4. Removable media and /tmp mounted nosuid?

5. Re-run the audit after changes.

Operational verification

binary with SUID bit executed → process gets the file owner's effective UID → runs with that privilege

Evidence · next step

For Permissions & Ownership → SUID, continue with the first unproven Topic check: Verify file identity, numeric owner, executable bits and SUID mode. If that boundary is healthy, advance to the adjacent check: Check mount and process constraints that can suppress privilege elevation. 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 understand privilege escalation by programs, and when auditing systems for risky SUID files.
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

executable inode + owner UID + SUID bit → exec request → mount/process/security constraints → new process effective UID → target access → workload result

Healthy evidence: the specific trusted executable uses SUID intentionally, the resulting effective UID is verified and only the required operation is enabled.

Step 2 Verification and output interpretation Verify boundary

Existing fast checks for this Topic. - Verify file identity, numeric owner, executable bits and SUID mode.

  • Check mount and process constraints that can suppress privilege elevation.
  • Capture real/effective/saved IDs after exec rather than inferring transition from ls output.
  • Validate the privileged operation and least-privilege design separately.

Verification chain. executable inode + owner UID + SUID bit → exec request → mount/process/security constraints → new process effective UID → target access → workload result

Step 3 Commands Verify boundary
find / -perm -4000 -type f 2>/dev/null
chmod u+s /usr/local/bin/tool
Step 4 Failure modes and next checks Narrow the fault

Suspicious evidence: SUID is added to fix unexplained access, scripts are expected to elevate portably, or metadata is treated as evidence of the post-exec credential.

Step 5 Common mistakes Narrow the fault
  • SUID on scripts or custom binaries.
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

SUID on a script is ignored by Linux; it only works on binaries. Every SUID-root binary is an attack surface — audit them and remove the bit where not needed. Mount options nosuid disable it on a filesystem.

Key checks
  • find / -xdev -perm -4000 -type f — SUID files
  • 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

Show the object is the intended executable, its owner and SUID bit are correct, then inspect whether the mount and execution context honor SUID and what effective credentials the new process actually receives. Treat privileged execution paths as high-risk and verify why the transition is required instead of using SUID as a broad permission workaround.

ReferenceImportant terms & boundaries5 sections · depth on demand

What this shows and what it does not

SUID metadata shows a requested privilege-transition property on a file, not that the kernel honored it or that the resulting program is secure/correct.

In depth

The set-user-ID bit (SUID)

A program with the set-user-ID bit runs with the privileges of the file's owner, not of the user who starts it. With a root-owned file, that means root privileges. The chmod(1) manual page writes this as s in the owner execute position, or as 4 in the leading octal digit (4755).

The credentials(7) manual page explains the mechanism: the effective UID becomes the file's owner, and the saved set-user-ID keeps a copy. The program can then drop and regain privilege as needed.

Where SUID is used

ProgramWhy
passwdWrites /etc/shadow for the user changing their own password
sudo, suSwitch user after authentication
mount, umountUser mounts allowed by fstab (user option)
pkexecpolkit privilege escalation

Risks

RiskWhy
A bug in an SUID root programIt becomes local root access
SUID on a shell or interpreterAnyone gets root
An SUID binary on removable mediaMount such media with nosuid
Capital S in ls -lSUID set but not executable: almost always a mistake

Linux ignores the SUID bit on shell scripts, so only compiled binaries are affected.

Auditing

Keep a list of SUID files and compare it regularly. A new SUID root binary that no package installed is a strong sign of compromise.

host$ ls -l /usr/bin/passwd /usr/bin/sudo
-rwsr-xr-x 1 root root  59976 Feb  6  2026 /usr/bin/passwd
-rwsr-xr-x 1 root root 277936 Apr  8  2026 /usr/bin/sudo
host$ sudo find / -xdev -perm -4000 -type f -printf '%u %m %p\n' 2>/dev/null | sort > /root/suid-$(date +%F).txt
host$ diff /root/suid-2026-11-01.txt /root/suid-2026-11-28.txt
> root 4755 /tmp/.cache/bash
host$ dpkg -S /usr/bin/passwd
passwd: /usr/bin/passwd
host$ grep -E "\s(/tmp|/home|/media)\s" /proc/mounts | grep -o "nosuid" | sort | uniq -c
host$ sudo chmod u-s /usr/local/bin/legacy-tool

Reading the diff

A root-owned SUID copy of bash under /tmp doesn't come from any package. It's a classic backdoor: anyone can run it with -p and get a root shell. Mounting /tmp with nosuid prevents such binaries from working, even if an attacker manages to create one.

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

SUID is part of Permissions & Ownership → SUID. SUID 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.

Topic-specific state model. SUID 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.

Technical metadata. Host/container/user-namespace identity, process PID/session/service, identity source/NSS result, username/group names, numeric UID/GID, real/effective/saved/fs credentials where relevant, supplementary groups, sudo invoking/target identity and matched policy, pathname + parent traversal, filesystem/inode, numeric owner/group, object type, octal/symbolic mode, SUID/SGID/sticky bits, access/default ACL entries and mask, mount flags and relevant non-DAC control, requested operation and original workload result.

Interpretation rule. - SUID bit set ≠ guaranteed effective-UID transition.

  • SUID on ordinary scripts is not a portable/supported privilege mechanism on Linux.
  • nosuid/no_new_privs/security policy can suppress or constrain privilege gain.
  • Effective UID transition ≠ application operation is safe or successful.

Quick reference

SUID on an executable runs it with the file owner's UID (usually root), e.g. passwd, sudo, ping (older), mount.

ls -l /usr/bin/passwd            # -rwsr-xr-x
find / -xdev -perm -4000 -type f -exec ls -l {} + 2>/dev/null
chmod u-s /usr/local/bin/oldtool

SUID binaries are a common privilege-escalation path: keep the list minimal, compare against a baseline, mount untrusted filesystems with nosuid, and never set SUID on scripts or interpreters (the kernel ignores SUID on scripts anyway). File capabilities (setcap cap_net_raw+ep) are a narrower alternative.

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. SUID metadata shows a requested privilege-transition property on a file, not that the kernel honored it or that the resulting program is secure/correct.

ReferenceConfiguration & state1 section · depth on demand

Configuration, persistence and lifecycle

Distribution/platform context. SUID owns file-owner credential transition semantics. Capabilities, sudo and LSM are separate privilege mechanisms.

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 → SUID. 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
setuid linuxsuid bitset user idsuid permissions
Embedded reference data

Quick lookup tables

SUID operational reference

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

Lookup boundaryTopic-specific referenceOperational use
Scope / effective stateSUID 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.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 chainexecutable inode + owner UID + SUID bit → exec request → mount/process/security constraints → new process effective UID → target access → workload resultTrace requested/configured state through effective state to the observed workload result.
Failure boundarySUID metadata proves a requested privilege-transition property on a file, not that the kernel honored it or that the resulting program is secure/correct.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: executable inode + owner UID + SUID bit → exec request → mount/process/security constraints → new process effective UID → target access → 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. SUID metadata proves a requested privilege-transition property on a file, not that the kernel honored it or that the resulting program is secure/correct.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.

SUID · operational reference

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

Reference boundarySUID
Topic pathPermissions & Ownership → SUID
Runtime stateSUID 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.
Fast checks- Verify file identity, numeric owner, executable bits and SUID mode. - Check mount and process constraints that can suppress privilege elevation. - Capture real/effective/saved IDs after exec rather than inferring transition from ls output. - Validate the privileged operation and least-privilege design separately.
Verification chainexecutable inode + owner UID + SUID bit → exec request → mount/process/security constraints → new process effective UID → target access → 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 boundarySUID metadata proves a requested privilege-transition property on a file, not that the kernel honored it or that the resulting program is secure/correct. 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?