brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: pwquality.conf sets the password rules for passwd, a security baseline in one file

Security
~/tips/tip-security-pwquality-minlen

sudo apt install libpam-pwquality

Makes passwd refuse short or dictionary passwords for local accounts.

Ubuntu checks new passwords with pam_pwquality, and its rules live in a plain config file. I’d rather set a long minimum there than a list of character class rules.

Install the module if it isn’t there yet, then add your own drop-in file:

sudo apt install libpam-pwquality
sudo mkdir -p /etc/security/pwquality.conf.d
printf 'minlen = 14\ndictcheck = 1\nenforce_for_root\n' | sudo tee /etc/security/pwquality.conf.d/50-local.conf

minlen is the minimum length; the default is 8 and it can’t go below 6. Before you raise it, check that the dcredit, ucredit and similar values are 0, the default on current versions. A positive credit lets each digit or capital count as an extra character, which makes a short password look longer than it is. dictcheck rejects passwords that match a dictionary word through cracklib, and it is on by default. enforce_for_root makes the rules apply when root changes a password too; without it root only gets a warning.

Test it right away with passwd on a test account and try something weak like summer2026.

Files in pwquality.conf.d are read in sorted order, and a later file overrides an earlier one for the same setting. These rules only apply when a password is changed through PAM. Existing passwords stay as they are, and SSH key logins are not affected at all.

Further reading: pwquality.conf(5) manual page

More Security tips tcpdump -nn -r capture.pcap port 53 mkcert -install Strict-Transport-Security: max-age=0 Referrer-Policy: strict-origin-when-cross-origin wp super-admin list All Security tips (79) All topics

Link