DEV Community

Piyapol
Piyapol

Posted on

Enforcing password policies on Ubuntu

Hi, in this blog, we are going to set up password policy enforcement to enhance overall security on Ubuntu.

Let's start with configure password complexity. First, install the libpam-pwquality.

sudo apt install libpam-pwquality
Enter fullscreen mode Exit fullscreen mode

Then, edit /etc/security/pwquality.conf with following configuration.

minlen = 14  # password must be at least 14 characters
minclass = 4 # minimum number of required classes of characters for the new password (digits, uppercase, lowercase, others)
Enter fullscreen mode Exit fullscreen mode

After that, edit /etc/login.defs with following configuration

PASS_MAX_DAYS 90 # password expiration days
PASS_MIN_DAYS 1  # days between password changes 
PASS_WARN_AGE 7  # warnings before expiration
Enter fullscreen mode Exit fullscreen mode

That's all. Now we have a more robust Ubuntu system.
Thank you for reading and have a nice day.

Top comments (0)