修改帐号和密码的有效期限
永久修改路径: /etc/login.defs
# Password aging controls:
#
# PASS_MAX_DAYS Maximum number of days a password may be used.
# PASS_MIN_DAYS Minimum number of days allowed between password changes.
# PASS_MIN_LEN Minimum acceptable password length.
# PASS_WARN_AGE Number of days warning given before a password expires.
#
PASS_MAX_DAYS 99999
PASS_MIN_DAYS 0
PASS_MIN_LEN 5
PASS_WARN_AGE 7
-l:列出具体信息
[root@localhost ~]# chage -l root
Last password change : Feb 21, 2016
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 : 7
-m:密码可更改的最小天数。0:任何时候都可以更改密码
[root@localhost ~]# chage -m 5 root
-M:密码保持有效的最大天数
[root@localhost ~]# chage -M 60 root
-W:用户密码到期前,提前收到警告的天数
[root@localhost ~]# chage -W 10 root
-E:账户到期的日期,过了这天,此帐号无法使用(-1为never)
[root@localhost ~]# chage -E 10 root
[root@localhost ~]# chage -l root
Last password change : Feb 21, 2016
Password expires : never
Password inactive : never
Account expires : Jan 11, 1970
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 10
-d:上一次更改的日期
[root@localhost ~]# chage -d 2016-11-10 root
[root@localhost ~]# chage -l root
Last password change : Nov 10, 2016
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 : 10
-i:停滞时间。如果密码已经过期这些天,那么这个帐号将不可用
[root@localhost ~]# chage -I -1 root