Use it to understand administrative access, and when hardening how root is used.
root
root (UID 0) is the superuser: it bypasses permission checks and can change anything on the system.
1. Who can become root? getent group sudo wheel and sudo -l -U <user>.
2. Root SSH allowed? sshd -T | grep -i permitrootlogin.
3. Root password set and stored safely for console recovery?
4. Recent root activity: journalctl _COMM=sudo / last root.
5. Remove unneeded admin rights.
admin user authenticates → sudo checks the sudoers rules → command runs as UID 0 → action logged
For Users & Groups → root, continue with the first unproven Topic check: Capture effective UID and namespace context of the actual process. If that boundary is healthy, advance to the adjacent check: Inspect relevant capabilities and non-DAC controls when UID 0 still fails. 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
root account resolution → UID 0/process namespace → effective capabilities → DAC + non-DAC policy → target operation → workload result
Healthy evidence: privilege level is explicit, the intended control path is understood and the workload succeeds under the correct least-privilege identity.
Step 2 Verification and output interpretation Verify boundary
Existing fast checks for this Topic. - Capture effective UID and namespace context of the actual process.
- Inspect relevant capabilities and non-DAC controls when UID 0 still fails.
- Compare root-only success with the intended workload identity to locate the authorization boundary.
- Verify the service/application under its normal principal after remediation.
Verification chain. root account resolution → UID 0/process namespace → effective capabilities → DAC + non-DAC policy → target operation → workload result
Step 3 Commands Verify boundary
sudo -i
passwd -S root
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: running as root is used to mask a permission defect, container root is assumed host-root equivalent, or a non-DAC denial is misread as ordinary mode-bit failure.
Step 5 Common mistakes Narrow the fault
- Daily work as root.
Step 6 Where it fails Narrow the fault
Also consider stale generated config, wrong environment, wrong namespace/chroot/container, package/provider mismatch, dependency ordering, immutable/read-only mounts, exhausted inode/block resources, capabilities, SELinux/AppArmor denial, systemd sandboxing, cgroup limits and boot-time state that differs from the interactive shell.
Do not infer root cause from one symptom. Connection refused can be process, socket binding, namespace, firewall or routing; permission denied can be Unix mode/ACL, mount option, capability or MAC policy; a full filesystem can be blocks, inodes, deleted-open files, snapshots or thin-pool exhaustion. Correlate native state across the responsible layers.
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.
Work as a normal user and use sudo for single commands; it logs who did what. Disable direct root SSH login (PermitRootLogin no or prohibit-password). Keep a way to reach root for recovery (console, rescue mode).
sshd -T | grep -i permitrootlogin— effective root login settingid <user>— UID, primary group and groupsgetent passwd <user>— account entry (local or directory)getent group <group>— group memberssudo -l -U <user>— what the user may run with sudo
ReferenceWhat it is1 section · depth on demand
Core model
Verify that the process actually has effective UID 0 in the relevant namespace, then inspect capabilities and the specific control that can still deny or alter the operation. Root commonly bypasses discretionary file permission checks, but it does not turn every operation into a guaranteed success and should not be used as a substitute for identifying the failing authorization boundary.
ReferenceImportant terms & boundaries5 sections · depth on demand
What this shows and what it does not
Root/UID 0 evidence shows a powerful process credential in a context, not universal authorization or correct service configuration.
In depth
root and how to use it safely
UID 0 is special. The credentials(7) manual page explains that changing a process's user and group IDs can also change its capabilities. A process running with UID 0 normally has the full capability set, which lets it bypass file permission checks, bind low ports, load modules and change any process. Being root is therefore all-or-nothing, which is why direct root use is kept to a minimum.
Ways to get root privilege
| Method | Logged as | Notes |
|---|---|---|
sudo <command> | The real user, the command, the target user | Preferred; per-command rules |
sudo -i / sudo -s | Session start only | A root shell; use sparingly |
su - | Switch to root | Needs the root password; no per-user audit |
| Direct root login (console, SSH) | root | Avoid; disable over SSH |
| Set-user-ID programs | — | Only for specific tools (passwd, ping on older systems) |
| Capabilities on a binary | — | Grant one privilege without full root (e.g. cap_net_bind_service) |
Good practice
| Practice | Reason |
|---|---|
PermitRootLogin no in sshd | Logins are attributable to people |
| Lock the root password, or set a strong one kept in a vault | Recovery still possible |
Use sudo with named commands where possible | Least privilege |
| Give services their own unprivileged accounts | A compromise doesn't give root |
| Prefer capabilities to running as root | e.g. a web server binding port 443 |
host$ sudo -l
User alice may run the following commands on srv1:
(root) /usr/bin/systemctl restart nginx, /usr/bin/journalctl
host$ sudo passwd -S root
root L 2026-03-03 0 99999 7 -1
host$ getcap /usr/bin/ping
/usr/bin/ping cap_net_raw=ep
host$ sudo setcap cap_net_bind_service=+ep /usr/local/bin/report-api
host$ grep -c "sudo:.*COMMAND=" /var/log/auth.log
host$ sudo journalctl _COMM=sudo --since today --no-pager | tail -3
Reading the example
passwd -S root shows L: the root password is locked, so password logins as root are impossible, while sudo still works. getcap shows that ping needs only the cap_net_raw capability instead of set-user-ID root. That's the same approach the setcap line applies to the custom service.
Documented example, not captured output.
How it works at runtime
root is part of Users & Groups → root. root is conventionally UID 0 and is the traditional Linux superuser identity, but effective privilege depends on the execution namespace, Linux capabilities, LSM policy, mount/filesystem constraints and application-level controls rather than the account name alone.
Topic-specific state model. root is conventionally UID 0 and is the traditional Linux superuser identity, but effective privilege depends on the execution namespace, Linux capabilities, LSM policy, mount/filesystem constraints and application-level controls rather than the account name alone.
Interpretation rule. - Username root ≠ evidence of effective UID 0 in the target process.
- UID 0 ≠ unrestricted host privilege inside every container/user namespace.
- DAC bypass ≠ bypass of SELinux/AppArmor, immutable state, read-only mounts or application policy.
- Command succeeds as root ≠ correct least-privilege configuration for the intended service user.
Quick reference
root (UID 0) bypasses most permission checks. Practices:
- Disable direct root SSH (
PermitRootLogin no); use named accounts + sudo. - Keep a strong root password (console/rescue) in a vault, or lock it where console access uses other means.
- Restrict
suto an admin group (auth required pam_wheel.so use_uidin/etc/pam.d/su). - Audit root activity (auditd rules with
auid).
sudo -i # root login shell (logged by sudo)
passwd -S root
grep -E '^root|:0:' /etc/passwd # any other UID 0 accounts?
Limits and how it fails
Primary failure point. Root/UID 0 evidence shows a powerful process credential in a context, not universal authorization or correct service configuration.
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.
Do not infer root cause from one log line, one status word or one command exit code when an adjacent dependency owns the next state transition.
ReferenceConfiguration & state1 section · depth on demand
Configuration, persistence and lifecycle
Distribution/platform context. root owns superuser identity semantics. sudoers owns delegated elevation; capabilities/LSM and platform security controls belong to their security branches.
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 Users & Groups → root. 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
root operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for root.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | root is conventionally UID 0 and is the traditional Linux superuser identity, but effective privilege depends on the execution namespace, Linux capabilities, LSM policy, mount/filesystem constraints and application-level controls rather than the account name alone. | 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 | root account resolution → UID 0/process namespace → effective capabilities → DAC + non-DAC policy → target operation → workload result | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | Root/UID 0 evidence proves a powerful process credential in a context, not universal authorization or correct service configuration. | 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: root account resolution → UID 0/process namespace → effective capabilities → DAC + non-DAC policy → target operation → 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. Root/UID 0 evidence proves a powerful process credential in a context, not universal authorization or correct service configuration. | 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. |
root · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | root |
|---|---|
| Topic path | Users & Groups → root |
| Runtime state | root is conventionally UID 0 and is the traditional Linux superuser identity, but effective privilege depends on the execution namespace, Linux capabilities, LSM policy, mount/filesystem constraints and application-level controls rather than the account name alone. |
| Fast checks | - Capture effective UID and namespace context of the actual process. - Inspect relevant capabilities and non-DAC controls when UID 0 still fails. - Compare root-only success with the intended workload identity to locate the authorization boundary. - Verify the service/application under its normal principal after remediation. |
| Verification chain | root account resolution → UID 0/process namespace → effective capabilities → DAC + non-DAC policy → target 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 boundary | Root/UID 0 evidence proves a powerful process credential in a context, not universal authorization or correct service configuration. Boundary chain: process/context → userspace configuration → kernel subsystem/resource → device/network/filesystem dependency → effective state → original workload. |
| Persistence rule | Prove which configuration source owns the state, then prove that the running consumer loaded or generated the intended state. |