Find user accounts with empty passwords

A quick audit that catches passwordless accounts — a silent backdoor on any Linux box.

LinuxpasswordsuserssecurityauditMedium risk
Run sudo awk -F: '($2 == "") {print $1}' /etc/shadow — every name printed has no password at all.

01Command

Command
$ sudo awk -F: '($2 == "" ) { print $1 " has NO password" }' /etc/shadow

02What it does

/etc/shadow stores password hashes, and an empty second field means that account can be logged into without typing anything — exactly the kind of leftover a fresh service install or an intruder leaves behind. This one-liner prints any such accounts, so an empty result is what you want to see. Regular system accounts normally show a hash or a '!'/'*' placeholder that blocks login.

03Risk

RiskMedium risk
!Warning: An empty field is not the same as '!' (locked); if you find a truly passwordless account, set one immediately with sudo passwd username — root itself should never be passwordless.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • shadow(5) — Linux manual page
    man7.org · community · 2026-09-17
    Evidence: In /etc/shadow, the second field holds the password hash; an empty field means the account can log in without a password.

Last verified: 2026-09-18 · Category: Security & Privacy

06Related solutions