I installed libpam-pwquality:

sudo apt-get install libpam-pwquality

And configured /etc/pam.d/common-password:

password        requisite                       pam_pwquality.so retry=3 minlen=10

password        [success=1 default=ignore]      pam_unix.so obscure use_authtok try_first_pass sha512
password        required                        pam_deny.so
password        required                        pam_permit.so

Then when I ran passwd, I could still set a password of 2 or 3 characters. What was missing?

  • What are the other lines? All i find refers to the first line and only this one being set! I also read later configurations overwrite earlier ones.
    – WGRM
    Commented Mar 23, 2020 at 11:52

1 Answer 1


You need to set the options in pwquality's configuration file, /etc/security/pwquality.conf.

  • this doesnt work for ubuntu 18.04 - weak passwords are still accepted :(
    – xhudik
    Commented Sep 26, 2018 at 19:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .