🔑password policy 🔑
Setting up basic password aging
Edit login definitions: First, we need to edit the login.defs file:
nano /etc/login.defsModify 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-pwqualityType 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_rootThis is how the line must be↙️

This is how the file must look ↙️

Last updated
Was this helpful?