๐password policy ๐
Setting up basic password aging
Edit login definitions: First, we need to edit the login.defs file:
nano /etc/login.defs
Modify password parameters: Locate and change the following parameters:
Change:
PASS_MAX_DAYS 99999
โPASS_MAX_DAYS 30
Change:
PASS_MIN_DAYS 0
โPASS_MIN_DAYS 2

Installing password quality enforcement
Install password quality library: To enforce password quality rules, install the following package:
sudo apt install libpam-pwquality
Type Y
when prompted to confirm and wait for the installation to complete.

Configuring password complexity rules
Edit PAM configuration: Next, we need to edit the PAM (Pluggable Authentication Modules) configuration file:
nano /etc/pam.d/common-password

Below retry=3 we must add the following commands:
minlen=10 ucredit=-1 dcredit=-1 lcredit=-1 maxrepeat=3 reject_username difok=7 enforce_for_root
This is how the line must beโ๏ธ

This is how the file must look โ๏ธ

Last updated
Was this helpful?