CentOS / RHEL : How to configure a user account to never expire (disable password ageing)

Question : How to configure a user account so that the password will never expire?

Answer:

By default passwords do not expire on user accounts. If an expiration date has been added to an account and you wish to remove it use either the passwd or chage commands to change the maximum number of days between password changes to -1.

For example, modifying the user “krishna” whose account is currently set to expire in 30 days:

# chage -l krishna
Minimum: 0
Maximum: 30
Warning: 7
Inactive: -1
Last Change: Nov 19, 2007
Password Expires: Dec 19, 2007
Password Inactive: Never
Account Expires: Never

As you can see from the output above, the maximum number of days between password changes is set to 30 days. Modify the maximum days so that the password does not expire:

# passwd -x -1 krishna

or

# chage -M -1 krishna

Verify

Verify the new value of “maximum number of days between password changes”. It should be -1.

# chage -l krishna
Minimum: 0
Maximum: -1
Warning: 7
Inactive: -1
Last Change: Nov 19, 2007
Password Expires: Never
Password Inactive: Never
Account Expires: Never
Related Post