How to Control Account expiration in linux: enterprise users can set the account validity period for unmanaged role accounts or temporary requirements of developers to improve security! Method 1: add the user useraddoldboy-e01/28/12 or modify the parameters of the following file: [root @ oldboyskel] # grepEXPIRE/etc/default/useraddEXPIRE = instance 7: specify the parameter to run useradd-D-e
How to Control Account expiration in linux:
In enterprises, you can set an account validity period for unmanaged role accounts or temporary needs of developers to improve security!
Method 1: When adding a user
Useradd oldboy-e 01/28/12
Or modify the parameters of the following file:
[Root @ oldboy skel] # grep EXPIRE/etc/default/useradd
EXPIRE =
Instance 7: specify the parameter to run useradd-D-e
[Root @ oldboy ~] # Date + % F
2012-01-25
[Root @ oldboy ~] # Useradd-D-e 01/19/12 # → modify the expiration time of the new account by default. after the Expiration Time is set, new users will expire after this time.
[Root @ oldboy ~] # Useradd-D | grep EXPIR # → modified results.
EXPIRE = 01/19/12
[Root @ oldboy ~] # Useradd tmpuser3 # → Add user tmpuser3. Note that the-e parameter is not added.
[Root @ oldboy ~] # Chage-l tmpuser3 # → view the account expiration time.
Last password Modification time: January 1, 2012
Password Expiration Time: never
Password Expiration Time: never
Account expiration time: January 1, January 19, 2012 # → The default expiration time of the change.
Minimum number of days between two password changes: 0
Maximum number of days between two password changes: 99999
Warning Days Before password expiration: 7
[Root @ oldboy ~] # Useradd-D-e "" # → Restore after testing
[Root @ oldboy ~] # Useradd-D
GROUP = 100
HOME =/home
INACTIVE =-1
EXPIRE = # → restored
SHELL =/bin/bash
SKEL =/etc/skel
CREATE_MAIL_SPOOL = yes
Note: only the default value of the configuration file has been changed. it takes effect only for new users created later and has nothing to do with old users.
When changing a User:
Method 2: modify account attributes
Usermod-e 01/28/12 oldboy
Method 3: adjust account expiration
Chage-E 01/28/12 oldboy
View Account expiration:
Chage-l oldboy
The configuration can be scripted, and a time parameter can be passed in each stage.
Make our work more standardized and professional!
Note:
The expiration time of c5.8 is postponed by two days on the specified date.
C6.4The expiration time is postponed by one day on the specified date.
This article from the "old boy linux O & M" blog, please be sure to keep this source http://oldboy.blog.51cto.com/2561410/1289144