chage
-m:密码可更改的最小天数。为零时代表任何时候都可以更改密码。-M:密码保持有效的最大天数。-w:用户密码到期前,提前收到警告信息的天数。-E:帐号到期的日期。过了这天,此帐号将不可用。-d:上一次更改的日期。-i:停滞时期。如果一个密码已过期这些天,那么此帐号将不可用。-l:例出当前的设置。由非特权用户来确定他们的密码或帐号何时过期
查询用户密码过期时间
[root@test-waf-ap01 ~]# cat /etc/passwd|grep boccfcboccfc:x:310:310::/home/boccfc:/bin/bash[root@test-waf-ap01 ~]#[root@test-waf-ap01 ~]# chage -l boccfcLast password change : Dec 09, 2020Password expires : Mar 09, 2021Password inactive : neverAccount expires : neverMinimum number of days between password change : 0Maximum number of days between password change : 90Number of days of warning before password expires : 7[root@test-waf-ap01 ~]#
[root@test-waf-ap01 ~]# chage -M 99999 boccfc[root@test-waf-ap01 ~]#[root@test-waf-ap01 ~]# chage -l boccfcLast password change : Dec 09, 2020Password expires : neverPassword inactive : neverAccount expires : neverMinimum number of days between password change : 0Maximum number of days between password change : 99999Number of days of warning before password expires : 7[root@test-waf-ap01 ~]#
