chage: create account passwords that expire after some time
This ‘password aging’ utility allows you to set an expire date for a user account password for better security.
‘chage’ is probably installed on your system (is part of
passwd package on Debian and
shadow package on Arch Linux). Then, you can type
chage -l <username> to check chage settings for that username:
$ chage -l ricardo Last password change : sep 12, 2021 Password expires : never Password inactive : never Account expires : never Minimum number of days between password change : 0 Maximum number of days between password change : 99999 Number of days of warning before password expires : 7
To edit chage settings for a user you need to be a root user or use
# To expire a password after 90 days since last password change chage -M 90 <username>
- You can disable password expiration as well:
chage -M -1 <username>
To expire a password inmediately (apply to next login):
chage -d 0 <username>
You can type
chage <username> to enter on interactive mode and edit all settings.
chage --help to get more info.
If you have any suggestion, feel free to contact me via social media or email.
Latest tutorials and articles: