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
- Make sure every user concerned has a password (
passwd <user>) and can still runsudo -v. - Edit the files with
visudo(orvisudo -f /etc/sudoers.d/<file>) and removeNOPASSWD:from each rule.
Rollback
Add the NOPASSWD: tag back with visudo.
References
- sudoers(5), Debian manual pages Debian, vendor-doc, accessed 2026-10-18
- ANSSI-BP-028 v2.0 - Recommandations de configuration d'un système GNU/Linux (R39) ANSSI, guide, accessed 2026-10-18
Mappings
| Framework | ID | Relation |
|---|---|---|
| ANSSI-BP-028 - Recommandations de configuration d'un système GNU/Linux2.0 | R39 | partial |
| NIST SP 800-53 Rev. 55.1.1 | IA-11 | related |
How this control relates to the other framework's: equivalent, stricter, looser, partial or related.
Threats mitigated
| Taxonomy | ID |
|---|---|
| MITRE ATT&CK | T1548.003 |
People and lifecycle
| Authors |
|
| Verified | 2026-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. |
| Verified | 2026-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 in | v0.1.0 |
| Created, updated | 2026-10-18, 2026-10-18 |
| Translations | fr |