Articles

"Your password will expire in 15 days", how to disable it or set new expire date

"Your password will expire in 15 days", how to disable it or set new expire date

Linux turn OFF password expiration

/etc/shadow stores actual password in encrypted format for user’s account with additional properties related to user password. The password expiration information for a user is contained in the last 6 fields. Password expiration for a select user can be disabled by editing the /etc/shadow file However I recommend using chage command. 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.

To list current aging type chage command as follows, need to execute in under root user: # chage -l myusername Output:
[root@undead gl]# chage -l myusername
Last password change : Nov 05, 2008
Password expires : Jan 04, 2009
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 60
Number of days of warning before password expires : 15
So "myusername" will expire password very soon, it's not fun ))). To disable password aging / expiration for user foo, type command as follows and set: Minimum Password Age to 0 Maximum Password Age to 99999 Password Inactive to -1 Account Expiration Date to -1 Interactive mode command (need to execute in under root user): you can edit this data manualy from next command:
[root@undead gl]# chage myusername
OR just execute this command to set "Password expires - to never"
[root@undead gl]# chage -I -1 -m 0 -M 99999 -E -1 myusername
It's all, you can check result:
[root@undead gl]# chage -l myusername
Last password change : Nov 05, 2008
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 : 15