Configure password aging controls for a user account using chage and validate the resulting policy state.
Practice enabling expiration rules, reviewing the policy, then disabling aging and cleaning up.
You are auditing password policy enforcement on a Linux host. A test account named expiringuser
must be created and configured with password aging rules to meet internal standards. You will enforce expiration,
minimum change windows, and warning periods, confirm the settings with a policy report, then disable aging and remove
the account.
This is the workflow you use to prove password aging is actually enforced, not just set in policy text somewhere.
chage reporting.chage.
sudo useradd expiringuser
Create a dedicated account so the policy changes are isolated and easy to inspect.
sudo passwd expiringuser
Password aging targets password metadata. Set a password first so the last password change field is meaningful.
sudo chage -M 30 expiringuser
Maximum age controls how long a password can remain valid before the user must change it.
sudo chage -m 7 expiringuser
Minimum age prevents rapid password cycling and supports stronger password rotation enforcement.
sudo chage -W 5 expiringuser
Warning days control when users begin receiving expiration warnings prior to password expiry.
sudo chage -l expiringuser
This is your proof step. It prints the effective aging configuration attached to the user account.
Last password change : Jul 18, 2025
Password expires : Aug 17, 2025
Password inactive : never
Account expires : never
Minimum number of days between password change : 7
Maximum number of days between password change : 30
Number of days of warning before password expires: 5
sudo chage -M -1 expiringuser
Setting max age to -1 disables expiration. Validate the result by re-checking the policy report.
sudo chage -l expiringuser
sudo userdel expiringuser
Remove the user once verification is complete so the host returns to a clean baseline state.
If you run chage before setting a password, the policy output may be confusing because the last-change
field is not meaningful. Set the password with passwd and re-check with chage -l.
Password aging is only one layer. Login restrictions may also depend on PAM and account state.
Confirm the user is not locked and verify policy again using chage -l.
This lab uses userdel without removing the home directory. If you created a home directory and want it removed,
use userdel -r.
getent passwd expiringuser
ps -u expiringuser
useradd: Creates a new user.passwd: Sets or changes a user password.chage: Manages password aging information.
-M: Set maximum password age in days.-m: Set minimum password age in days.-W: Set warning days before expiration.-l: List current aging settings.userdel: Deletes a user account.getent: Queries system databases.ps: Lists processes.
-u: Select processes by effective user.