Pcornel
Browse topics
Options
Recent
Favorites
Security · Technical reference

sudo

Direct answer

sudo delegates selected commands or roles under policy with invoking/target identities, host and argument constraints, authentication, environment handling, logging and session lifetime rather than granting unrestricted root by default.

When to use this

Use it when configuring, checking or troubleshooting sudo in Linux Security.

First 30 seconds

1. sudo grants limited root actions.

2. Use groups and specific commands.

3. Avoid NOPASSWD and shell escapes (vim, less).

4. Log via syslog/sudo I/O logs.

5. Edit with visudo.

Operational verification

user → sudoers rule → command as root → logged

Context & applicabilityCommon mistakes · platform/version boundaries
Common mistakes
Common traps

A sudo policy match shows delegated execution under specified conditions, but it does not show the command cannot escape or the human action was authorized in context.

Suspicious evidence: ALL grant, wildcard arguments, writable command path, editor/shell escape, preserved dangerous environment, included file shadowing, long timestamp or logs incomplete.

Platform / version applicability
Platform and workload security
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.

PlatformPlatform and workload security
Scope / prerequisiteUse it when configuring, checking or troubleshooting sudo in Linux Security.
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.

1 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 Verification path Verify boundary

invoking identity/host → sudo policy parse/order → authentication/session → command/path/args/environment match → target credentials → execution/log → resource outcome

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
  • sudo access ≠ root shell intentionally or safely permitted.
  • Command path restricted ≠ arguments, environment, editors or child processes non-escapable.
  • Configuration file present ≠ parsed, loaded and effective runtime state.
  • One allow/deny result ≠ complete DAC, privilege, LSM, firewall and application outcome.
Key checks
  • sudo -l -U <user> — rights
  • visudo -c — syntax check
  • grep -r NOPASSWD /etc/sudoers /etc/sudoers.d/ — passwordless rules
ReferenceImportant terms & boundaries2 sections · depth on demand

What this shows and what it does not

A sudo policy match shows delegated execution under specified conditions, but it does not show the command cannot escape or the human action was authorized in context.

In depth

sudo lets permitted users run specific commands as root or another user, with every use logged. It replaces shared root passwords with individual accountability and allows fine-grained privilege.

# /etc/sudoers.d/netops  (edit with visudo -f)
%netops ALL=(root) /usr/bin/systemctl restart nginx, /usr/bin/journalctl -u nginx
Defaults:%netops log_output, timestamp_timeout=5

Pitfalls:

Risky ruleWhy
ALL=(ALL) NOPASSWD: ALLFull root without re-authentication
Allowing editors, pagers, interpreters (vi, less, python)Can spawn shells
Wildcards in argumentsCan be abused to run other commands
Scripts writable by the userUser can change what runs as root
sudo -l              # what may I run?

Send sudo logs centrally; consider sudo_logsrvd or session recording for privileged access.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
ReferenceConfiguration & state1 section · depth on demand

Configuration

# /etc/sudoers.d/netops   (edit with visudo -f)
%netops ALL=(root) /usr/bin/systemctl restart nginx, /usr/sbin/nft list ruleset
Defaults logfile=/var/log/sudo.log
Defaults use_pty

Documented example, not captured output. Avoid NOPASSWD: ALL and commands that allow shell escapes (vi, less, find -exec, tar). sudo -l shows what a user may run. sudo versions before 1.9.5p2 had a critical heap overflow (Baron Samedit); keep it patched.

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 docPlatform and workload security current

Authoritative/upstream documentation reviewed for bounded claims in Linux Security → sudo. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://docs.kernel.org/security/ · confidence 94%
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
sudoersLinux privilege delegationsudo security
Embedded reference data

Quick lookup tables

Linux Security → sudo proof map

Fast scope, effective-state, runtime-evidence and closure boundaries for Linux Security → sudo.

BoundaryEstablishDoes not establish
ScopeExact host, role, build/kernel, identity, workload and expected controlDoes not prove policy receipt or effective runtime state
Effective stateResultant/loaded policy, precedence, mode, labels/rules/keys and active services/kernel controlsConfiguration presence does not prove enforcement
Runtime evidenceCorrelated events/audit, process/token/credential, packet/syscall and workload resultOne event, clean status or allow/deny does not prove complete security
ClosureOriginal allowed/denied workload works, unsafe state is removed and recovery/regression passCommit, restart, block or compliance result alone is not closure
Confirmation

Confirm action

Continue?