chage password expiry information

chage – change user password expiry information

 

chage 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 her password. The chage command is restricted to the root user, except for the -l option, which may be used by an unprivileged user to determine when her password or account is due to expire.

 

chage -l shows password aging information about user

[root@changeme ~]# chage -l bijan
Last password change : Jan 28, 2015
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

force users to chage their password upon first login

chage -d 0 bijan

try to login with bijan, it will say password

login as: bijan
bijan@192.168.2.16's password:
You are required to change your password immediately (root enforced)
WARNING: Your password has expired.
You must change your password now and login again!
Changing password for user bijan.
Changing password for bijan.
(current) UNIX password:

 

[now i will change aging information for user bijan

[root@changeme ~]# chage -m 2 -M 90 -I -1 -E -1 -W 4 bijan

-m 2   minimum number of days between password change,  here bijan wont be able to change his password for 2 days after he changes he password

-M password will expire after 90 days

-I -1 wiil set the passord inactive to never

-E -1 account will never expire

-W 4 user will start getting warning 4 days before password expires

 

now check if the changes took effect

[root@changeme ~]# chage -l bijan
Last password change : Jan 28, 2015
Password expires : Apr 28, 2015
Password inactive : never
Account expires : never
Minimum number of days between password change : 2
Maximum number of days between password change : 90
Number of days of warning before password expires : 4

 

Leave a Reply