How to force users to use secure passwords on Ubuntu/Debian Linux

Originally published at:

My Linux shell user can modify their password using the passwd command. How can I force users to choose the secure password that will prevent users from using stupid passwords like “abc123”, “password”, “123456” and so on? How do I setup password quality requirements on my Debian or Ubuntu Linux server?

Use PAM to control given password