security.frabs.net
All Guides

Logins · about 3 minutes

Lock Accounts With No Password

What This Means

An account can log in with an empty password.

Why It Matters

Anyone who can reach a login prompt can use it without knowing anything.

  1. 1

    Find accounts with no password

    awk -F: '$2 == "" { print $1 }' /etc/shadow
    Terminal: Find accounts with no password, on Ubuntu 24.04
  2. 2

    Lock it

    passwd -l locks the password. Set a real one instead with passwd demo if the account is needed.

    passwd -l demo
    Terminal: Lock it, on Ubuntu 24.04
  3. 3

    Confirm none are left

    No output means every account has a password or is locked.

    awk -F: '$2 == "" { print $1 }' /etc/shadow; echo done
    Terminal: Confirm none are left, on Ubuntu 24.04

Check It’s Fixed

Run the security report again. This check should now pass.

More Logins Guides

Stop Root Logging In Over SSH With a PasswordTurn Off SSH Password LoginsLimit SSH Password TriesRemove Extra Accounts With Root Powers