How to change the password aging policies?


How to change the password Aging Policies?

In Linux, we can change the password policies in 2 ways.

(i) First open the /etc/login.defs file and modify the current values.

Example: # vim /etc/login.defs

min – 0: means the user can change the password to any no. of times.

min – 2: means the user can change the password within 2 days. ie., he can change the password after 2 days.

max – 5: means the user should change the password before or after 5 days. Otherwise the password will be expired after 5 days.

inactive – 2: means after password expiry date the grace period another 2 days will be given to change the password.

warning – 7: means a warning will be given to the user about the password expiry 7 days before expiry date.

Related Articles:

How to lock the user, if he enters wrong password multiple times?

How to set the Priority for a process in Linux?

(ii) second by executing the # chage command.

Example: # chage <options><user name>

The options are, -d –> last day

-E –> expiry date

-I –> inactive days

-l –> list all the policies

-m –> min. days

-M –> max. days

-w –> warning days

Note : Whenever we change the password aging policy using #chage command, the information is will be modified in /etc/shadow file.


Please enter your comment!
Please enter your name here