Debian GNU/Linux · Accounts & authentication

Require a password for every sudo rule

When it fails: Some sudo rules run commands without asking for a password. Anyone who takes over such an account, or just an unlocked session, gets root without knowing any secret.

CB-DEB-AUTH-006highactiveautomatedprofile server-hardenedprofile desktop-hardened

Description

A sudo rule tagged NOPASSWD: runs commands without asking the user for their password.

Debian cloud images get a NOPASSWD:ALL rule for the default user from cloud-init, in /etc/sudoers.d/90-cloud-init-users. Set a password for that user before removing the rule.

Rationale

The password prompt is the last barrier between a stolen session or a compromised process running as an administrator and full control of the system. Without it, privilege escalation needs no secret at all.

Impact

Automation that relies on password-less sudo (configuration management, deployment accounts) needs another approach: a dedicated account restricted to precise commands, run from a controlled host, or root access through SSH keys for that tool only.

Applies when

Detected: when: sudo is installed A scanner reports the control not applicable when one is false.

Audit

Run grep -r NOPASSWD /etc/sudoers /etc/sudoers.d/. There must be no match.

Automated: every check must pass. Scanners report each check by its id.

sudoers

No NOPASSWD tag in /etc/sudoers.

path: /etc/sudoers
pattern: ^[^#]*NOPASSWD
expect: no_match

sudoers-d

No NOPASSWD tag in /etc/sudoers.d/.

path: /etc/sudoers.d/*
pattern: ^[^#]*NOPASSWD
expect: no_match

Remediation

  1. Make sure every user concerned has a password (passwd <user>) and can still run sudo -v.
  2. Edit the files with visudo (or visudo -f /etc/sudoers.d/<file>) and remove NOPASSWD: from each rule.

Rollback

Add the NOPASSWD: tag back with visudo.

References

Mappings

How this control relates to the other framework's: equivalent, stricter, looser, partial or related.

Threats mitigated

People and lifecycle

Authors
Verified2026-10-18 by Sn0wAlice on 12, Proxmox VM, Debian 12 genericcloud image, kernel 6.1.0-54-cloud-amd64. Fails on the cloud image (cloud-init NOPASSWD rule) as expected; manual fix.
Verified2026-10-18 by Sn0wAlice on 13, Proxmox VM, Debian 13 genericcloud image, kernel 6.12.113+deb13-cloud-amd64. Fails on the cloud image (cloud-init NOPASSWD rule) as expected; manual fix.
Introduced inv0.1.0
Created, updated2026-10-18, 2026-10-18
Translationsfr