Linux Labs

Server security / Stage 4 of 10

PAM: password policy and lockout

Not running Starting usually ~20 s
Leave the lesson

Step 3 of 8 · theory · 3 min

A password quality policy

For the system to reject a weak password, a quality check — pwquality — is added to the password-change stack.

In the image the password is checked only by the pam_unix module with the obscure option: it catches the crude cases — a too-short password, a palindrome, a single case change. The eight-letter dictionary word password passes that check. The pwquality check knows more: a minimum length, a number of character classes, a dictionary. You turn it on with sudo pam-auth-update --enable pwquality — it adds the line pam_pwquality.so to common-password.

The check's rules live in /etc/security/pwquality.conf. The two main lines: minlen — the minimum password length, minclass — how many different character classes it must contain (lowercase, uppercase, digits, symbols). An empty file means the built-in values; you write your own rules as a line name = value.

Key points

  • By default the password is checked only by pam_unix with obscure — crude cases, not a dictionary.
  • pwquality is turned on with sudo pam-auth-update --enable pwquality: pam_pwquality.so appears in common-password.
  • The policy lives in /etc/security/pwquality.conf: minlen sets the length, minclass the number of character classes.
Ubuntu 24.04
Loading…