修改帐号和密码的有效期限
# chage --help
Usage: chage [options] [LOGIN]
Options:
-d, --lastday LAST_DAY set date of last password change to LAST_DAY
-E, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
-h, --help display this help message and exit
-I, --inactive INACTIVE set password inactive after expiration
to INACTIVE
-l, --list show account aging information
-m, --mindays MIN_DAYS set minimum number of days before password
change to MIN_DAYS
-M, --maxdays MAX_DAYS set maximim number of days before password
change to MAX_DAYS
-W, --warndays WARN_DAYS set expiration warning days to WARN_DAYS
参数意思: -m 密码可更改的最小天数。为零时代表任何时候都可以更改密码。 -M 密码保持有效的最大天数。 -W 用户密码到期前,提前收到警告信息的天数。 -E 帐号到期的日期。过了这天,此帐号将不可用。 -d 上一次更改的日期 -I 停滞时期。如果一个密码已过期这些天,那么此帐号将不可用。 -l 例出当前的设置。由非特权用户来确定他们的密码或帐号何时过期。
列出当前帐号过期信息:
#chage -l myuser
Last password change : Aug 14, 2015
Password expires : Nov 12, 2015
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 90
Number of days of warning before password expires : 7
修改密码过期时间:
chage -M 180 cpe --密码过期周期最多180天
chage -m 180 cpe--密码过期周期最少180天
再查一下过期信息:
chage -l myuser
Last password change : Aug 14, 2015
Password expires : Feb 10, 2016
Password inactive : never
Account expires : never
Minimum number of days between password change : 180
Maximum number of days between password change : 180
Number of days of warning before password expires : 7