How to set expiry date for user in linux
In Previous tutorial we learn about how to add a
new user and how to set passwd to user
in linux now we will learn about changing the password parameters in linux.
For changing of the password parameters and set
expiry date you need to use the chage command. It will display password expiry
information as well as 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 or her password.
Changing of the password parameters can be done by
two ways.
#chage
<user name>
#chage
<option> <value> <username>
Lets see the frist method and then the other.
To set the password parameters of a user “nagios” to
- Min password age : 2 days
- Max password age : 7 days
- Password expiration warnings: 2 days before password expires
- Password inactive [-1]: 0 same day account is locked after password expiry.
- A/C expiration date : 2011-12-31 (dec 31st 2011)
#
chage nagios
[root@linuxelearn
~]# chage nagios
Changing
the aging information for nagios
Enter
the new value, or press ENTER for the default
Minimum Password Age [0]: 2
Maximum Password Age [99999]: 7
Last Password Change (YYYY-MM-DD)
[2016-08-14]:
Password Expiration Warning [7]: 2
Password Inactive [-1]: 0
Account Expiration Date (YYYY-MM-DD)
[1969-12-31]: 2016-12-25
[root@linuxelearn
~]#
|
View
account password detail information:
To see account password detail information such as
expiry date and time, enter:
#
chage -l <username>
To see account password parameter info for nagios :
#
chage -l nagios
[root@linuxelearn
~]# chage -l nagios
Last
password change : Aug 14, 2016
Password
expires
: Aug 21, 2016
Password
inactive
: Aug 21, 2016
Account
expires :
Dec 25, 2016
Minimum
number of days between password change : 2
Maximum
number of days between password change : 7
Number
of days of warning before password expires : 2
[root@linuxelearn
~]#
|
The second method is for, if you want to change a particular
field of password aging policy
#
change <option> <value> <username>
The options which can be used are as follows
- -m foe Min password age
- -M for Max password age
- -d for last time the password is changed.
- -W password expiration warnings
- -I Password inactive [-1 means inactive].
- -E A/C expiration date
Let’s see how to change only the account expiration
date
[root@linuxelearn
~]# chage -E 2017-1-1 nagios
[root@linuxelearn
~]#
|
[root@linuxelearn
~]# chage -l nagios
Last
password change : Aug 14,
2016
Password
expires
: Aug 21, 2016
Password
inactive
: Aug 21, 2016
Account
expires :
Jan 01, 2017
Minimum
number of days between password change : 2
Maximum
number of days between password change : 7
Number
of days of warning before password expires : 2
[root@linuxelearn
~]#
|
Likewise you can use any option listed above and
change any particular field in password aging parameters.
You Must have to Read This...
If You Like this post then Comment and share Please..................
Post a Comment