Linux Command: chage
Change user password expiry information
chage changes user password aging information. It manages password expiration policies including maximum age, minimum age, warning days, and account expiration. chage is essential for enforcing password policies, meeting compliance requirements (PCI-DSS, HIPAA), and managing contractor/temporary accounts with automatic expiration. chage interacts with the shadow password file (/etc/shadow) and requires root privileges to modify other users' settings. Users can view their own aging info with chage -l.
Syntax
chage [OPTION]... USERNAMEKey Options
-lโ List password aging info for user-Mโ Maximum days between password changes-mโ Minimum days between password changes-Wโ Warning days before password expires-Eโ Set account expiration date-dโ Set date of last password change
Examples
View password info
sudo chage -l jdoeOutput: Last password change: Jan 01, 2024
Password expires: Apr 01, 2024
Account expires: never
Set 90-day password policy
sudo chage -M 90 -m 7 -W 14 jdoeForce password change
sudo chage -d 0 jdoePro Tips
- For PCI-DSS: chage -M 90 -m 1 -W 14 -I 30 user. This sets 90-day expiry, 1-day minimum, 14-day warning, 30-day inactive lock.
- chage -d 0 forces password change at next login. chage -E date expires the entire account.
- Users can run chage -l username to see their own password aging info. This is by design for self-service.
Learn more: Full chage reference โ