How to Manage Linux Users expiration or aging settings

As system admin on Linux and Unix bases systems is very important that you have a good knowledge on how to manage and deal with your Users password expiration or aging settings. The utility that i prefer for this task is called chage. The chage command changes the number of days between password changes and the date of the last password change. This information is used by the system to determine when a user must change his/her password. Options and syntax of the chage command:

[aodba]$ chage --help

Usage: chage [options] user

Options:
  -d, --lastday LAST_DAY        set last password change to LAST_DAY

  -E, --expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE

  -h, --help                    display this help message and exit

  -I, --inactive INACTIVE       set password inactive after expiration

                                to INACTIVE
  -l, --list                    show account aging information

  -m, --mindays MIN_DAYS        set minimum number of days before password

                                change to MIN_DAYS
  -M, --maxdays MAX_DAYS        set maximim number of days before password

                                change to MAX_DAYS
  -W, --warndays WARN_DAYS      set expiration warning days to WARN_DAYS
  • To list current aging type chage command as follows:
[aodba]$ chage -l adrian.oprea
Last password change                                    : Jul 22, 2014
Password expires                                        : Oct 20, 2014
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : 1
Maximum number of days between password change          : 90
Number of days of warning before password expires       : 7
Let's see how we can alter this definitions How to alter the "Maximum number of days between password change"
[root@aodba ~]# chage -M 160 adrian.oprea

--verify the definition 

[root@aodba ~]# chage -l adrian.oprea
Last password change                                    : Jul 22, 2014
Password expires                                        : Dec 29, 2014
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : 1
Maximum number of days between password change          : 160
Number of days of warning before password expires       : 7
How to alter the "Number of days of warning before password expires"
[root@aodba ~]# chage -W 3 adrian.oprea

--verify the definition

[root@aodba ~]# chage -l adrian.oprea
Last password change                                    : Jul 22, 2014
Password expires                                        : Dec 29, 2014
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : 1
Maximum number of days between password change          : 160
Number of days of warning before password expires       : 3
Also we we can do this on single line
[root@aodba ~]# chage -W 3 -M 160 adrian.oprea

--verify the definition

[root@aodba ~]# chage -l adrian.oprea
Last password change                                    : Jul 22, 2014
Password expires                                        : Dec 29, 2014
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : 1
Maximum number of days between password change          : 160
Number of days of warning before password expires       : 3
I hope this was helpful.