Audit and remediate a user’s password aging policy using
chage
. Apply minimum/maximum age, warning window, inactivity after
expiry, account expiration date, and force a password change at
next login. Verify the final state and leave the account in a
sane, standards-aligned configuration.
User fatima was locked out after a policy change. Security wants the account aligned to the new standard:
This is a targeted remediation. First prove current policy,
then apply each control explicitly, then verify the final
state using
chage -l
.
chage -l
.
-m
(min),
-M
(max),
-W
(warning).
-I
(inactive days after password expiry).
-E
(date the account expires, independent of password expiry).
-d 0
(force change next login) and
-d YYYY-MM-DD
(set last change date).
sudo chage -l fatima
Start by collecting the current state. This gives you a baseline and prevents “I think I set it” drift. It also shows the computed dates (expires/inactive/account expiry) which you can sanity-check against policy.
Last password change : May 20, 2025
Password expires : Aug 18, 2025
Password inactive : Sep 17, 2025
Account expires : Dec 31, 2025
Minimum number of days between password change : 7
Maximum number of days between password change : 90
Number of days of warning before password expires : 14
sudo chage -m 7 fatima
Minimum age prevents rapid password cycling and supports policy compliance. This setting affects when the user is allowed to change the password again after a change.
sudo chage -M 90 fatima
Maximum age defines when the password expires. Once expired, the account may still be usable depending on system policy, but password-based login typically requires a change.
sudo chage -W 14 fatima
Warning days control when the user starts receiving expiry warnings. This reduces surprise lockouts and improves compliance.
sudo chage -I 30 fatima
After the password expires, the account can remain usable for a grace period depending on configuration. Once the inactivity window is reached, the password becomes inactive and the account is effectively disabled for password-based login until remediated.
sudo chage -E 2025-12-31 fatima
Account expiration is independent of password expiration. On the expiration date, the account is expired regardless of password state.
sudo chage -d 0 fatima
Setting the last password change date to
0
forces an immediate change on next login. This is common
after remediation or when resetting credentials.
sudo chage -d 2025-06-01 fatima
This sets an explicit last-change date which affects when
the password expires based on the maximum age. In practice,
you would use either
-d 0
to force a change or set a specific last-change date, based
on the remediation intent.
sudo chage -l fatima
Verification is the deliverable. Confirm the min/max/warn values, check the computed expiry and inactive dates, and ensure the account expiry date matches the standard.
Last password change : Jun 01, 2025
Password expires : Aug 30, 2025
Password inactive : Sep 29, 2025
Account expires : Dec 31, 2025
Minimum number of days between password change : 7
Maximum number of days between password change : 90
Number of days of warning before password expires : 14
Password aging settings modify shadow metadata. Run with
sudo
and ensure you have privileges to manage local accounts.
The computed expiry date depends on the last password change
date plus the maximum age. If you set
-d 0
and then set a specific
-d YYYY-MM-DD
later, the second command defines the final state.
Password expiry controls credential validity. Account expiry
(
-E
) disables the account on that date regardless of password
settings.
Inactive days apply after the password expires. If the user is locked out for other reasons (locked password, expired account, PAM policy), you may need additional checks outside chage.
This lab leaves the account configured per the stated standard. If you are using a disposable lab user, your cleanup is confirming the final state and documenting the settings you applied.
sudo chage -l fatima
chage -l
shows min/max/warn/inactive/account-expiry values matching
policy, and computed dates that align with your configured
last-change date.
chage -l <user>
: Displays password aging information for a user.
chage -m <days> <user>
: Sets the minimum number of days between password changes.
-m
: Minimum days between changes.
chage -M <days> <user>
: Sets the maximum number of days a password is valid.
-M
: Maximum days before password expires.
chage -W <days> <user>
: Sets the warning days before password expiration.
-W
: Warning window.
chage -I <days> <user>
: Sets inactivity days after password expiration.
-I
: Days after expiry before password becomes inactive.
chage -E <YYYY-MM-DD> <user>
: Sets the account expiration date.
-E
: Account expires on the specified date.
chage -d 0 <user>
: Forces a password change at next login.
-d 0
: Sets last-change to epoch day 0 to force change.
chage -d <YYYY-MM-DD> <user>
: Sets the last password change date explicitly.
-d
: Last password change date (affects computed expiry).