View or change a user accounts aging information using the CHAGE command in Linux

Home > Search > Linux commands
  by

The chage (change age) command can be used to view and change a user accounts aging information.

 


View aging information

The chage -l (list) command can be used to view information about a user account age. When creating a new account using the useradd command, Last password change will be the date the new account was created.

~]# chage -l JohnDoe
Last password change                               : Aug 01, 2016
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 passwd command can be used to create or update an encrypted password.

The usermod -p command can be used to create or update an unencrypted password. In this example, user1 unencrypted password is example.

 


John Doe must change his password once every 365 days. Setting this to 99999 means John Doe never needs to reset his password.

~]# chage -M 365 JohnDoe
. . .
Maximum number of days between password change     : 365

 


John Doe must change his password before January 01, 2020. Set this to -1 to set this to never.

~]# chage -E 01-01-2020 JohnDoe
. . .
Password expires                   : Jan 01, 2020

 


Warn John Doe that his password will expire in 14 days.

~]# chage -W 14 JohnDoe
. . .
Number of days of warning before password expires  : 14

 


If John Doe does not change his password before it expires, give John Doe an extra 7 days to change his password. Setting this to -1 sets this to never.

~]# chage -I 7 JohnDoe
. . .
Password inactive              : 7

 


John Doe can only change his password once every 24 hours. Setting this to 0 disables this control.

~]# chage -m 1 JohnDoe
. . .
Minimum number of days between password change     : 1 

 

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments