Objective: Check the user account password expiry information on Linux.
User password expiry information can be checked using the chage
command. It can display password expiry date, the date of last password change and the number of days between password change. All these information is stored in the /etc/shadow
file.
To view the user password aging information, run:
1 2 3 4 5 6 7 8 |
$ chage -l ibrahim Last password change : Jan 27, 2018 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 |
The above account has password aging disabled. An account with password aging set might look like the one below.
1 2 3 4 5 6 7 8 |
$ chage -l admin Last password change : Feb 23, 2018 Password expires : Mar 25, 2018 Password inactive : never Account expires : Jan 01, 2019 Minimum number of days between password change : 7 Maximum number of days between password change : 30 Number of days of warning before password expires : 7 |