指令介紹
指令:chage 管理使用者密碼時效問題
用法:chage [options] LOGIN chage 使用者
指令選項
[root@fp-21 ~]# chage
-d, --lastday LAST_DAY # 指定日期為最近一次密碼修改時間
-E, --expiredate EXPIRE_DATE # 指定日期為使用者密碼過期時間
-h, --help # 幫助文檔
-I, --inactive INACTIVE # 密碼過期後,設定為失效
-l, --list # 顯示使用者密碼資訊
-m, --mindays MIN_DAYS # 設定兩次更改密碼之間的最短天數
-M, --maxdays MAX_DAYS # 設定兩次更改密碼之間的最長天數
-W, --warndays WARN_DAYS # 設定密碼失效前的警告天數
指令執行個體
# 指定日期為最近一次密碼修改時間
[[email protected]-21 ~]# chage -d 2020/2/15 tom
[[email protected]-21 ~]# chage -l tom
Last password change : Feb 15, 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
# 指定日期為使用者密碼過期時間
[[email protected]-21 ~]# chage -E 2020/2/20 tom
[[email protected]-21 ~]# chage -l tom
Last password change : Feb 15, 2020
Password expires : never
Password inactive : never
Account expires : Feb 20, 2020
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
# 顯示使用者密碼資訊
[[email protected]-21 ~]# chage -l tom
Last password change : Feb 15, 2020
Password expires : never
Password inactive : never
Account expires : Feb 20, 2020
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
# 設定兩次更改密碼之間的最短天數
[[email protected]-21 ~]# chage -m 1 tom
[[email protected]-21 ~]# chage -l tom
Last password change : Feb 15, 2020
Password expires : never
Password inactive : never
Account expires : Feb 20, 2020
Minimum number of days between password change : 1
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7
# 設定兩次更改密碼之間的最長天數
[[email protected]-21 ~]# chage -M 10 tom
[[email protected]-21 ~]# chage -l tom
Last password change : Feb 15, 2020
Password expires : Feb 25, 2020
Password inactive : never
Account expires : Feb 20, 2020
Minimum number of days between password change : 1
Maximum number of days between password change : 10
Number of days of warning before password expires : 7
# 設定密碼失效前的警告天數
[[email protected]-21 ~]# chage -W 3 tom
[[email protected]-21 ~]# chage -l tom
Last password change : Feb 15, 2020
Password expires : Feb 25, 2020
Password inactive : never
Account expires : Feb 20, 2020
Minimum number of days between password change : 1
Maximum number of days between password change : 10
Number of days of warning before password expires : 3
link 檢視 Linux 基礎指令