Linux 基礎命令 -- chage

命令介紹

命令: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      # 設置密碼失效前的警告天數

命令實例

# 指定日期爲最近一次密碼修改時間
[root@fp-21 ~]# chage -d 2020/2/15 tom
[root@fp-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

# 指定日期爲用戶密碼過期時間
[root@fp-21 ~]# chage -E 2020/2/20 tom
[root@fp-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

# 顯示用戶密碼信息
[root@fp-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


# 設置兩次更改密碼之間的最短天數
[root@fp-21 ~]# chage -m 1 tom
[root@fp-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

# 設置兩次更改密碼之間的最長天數
[root@fp-21 ~]# chage -M 10 tom
[root@fp-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

# 設置密碼失效前的警告天數
[root@fp-21 ~]# chage -W 3 tom
[root@fp-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 基礎命令

只有注入思想的博客纔是好的博客

發佈了26 篇原創文章 · 獲贊 126 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章