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