1. 程式人生 > 其它 >Linux(CentOS)使用者修改密碼有效期

Linux(CentOS)使用者修改密碼有效期

1、 先檢視密碼過期時間:

[root@01 ~]# chage -l testuser
Last password change     : Jul 10, 2017
Password expires     : Oct 08, 2018
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    : 
10

2、用命令修改過期時間為永久,然後檢視Password expires : never 和 Maximum number of days between password change : 99999修改成功

[root@01 ~]# chage -M 99999 testuser
[root@01 ~]# chage -l testuser
Last password change                    : Jul 10, 2017
Password expires                    : never
Password inactive                    : never
Account expires                        : Oct 16, 2243
Minimum number of days between password change        : 0
Maximum number of days between password change        : 99999
Number of days of warning before password expires    : 10

3、補充知識===================chage命令用法:

chage:密碼失效是通過此命令來管理的。
 
  引數意思:
  -m 密碼可更改的最小天數。為零時代表任何時候都可以更改密碼。
  -M 密碼保持有效的最大天數。
  -W 使用者密碼到期前,提前收到警告資訊的天數。
  -E 帳號到期的日期。過了這天,此帳號將不可用。
  -d 上一次更改的日期
  -I 停滯時期。如果一個密碼已過期這些天,那麼此帳號將不可用。
  -l 例出當前的設定。由非特權使用者來確定他們的密碼或帳號何時過期。

  

[root@localhost ~]# chage -l test      #檢視使用者密碼設定情況
最近一次密碼修改時間                                    :  4月 
27, 2018 密碼過期時間 : 從不 密碼失效時間 : 從不 帳戶過期時間 : 從不 兩次改變密碼之間相距的最小天數 :-1 兩次改變密碼之間相距的最大天數 :-1 在密碼過期之前警告的天數 :-1 [root@localhost ~]# chage -M 90 test #密碼有效期90天 [root@localhost ~]# chage -d 0 test #強制使用者登陸時修改口令 [root@localhost ~]# chage -d 0 -m 0 -M 90 -W 15 test #強制使用者下次登陸時修改密碼,並且設定密碼最低有效期0和最高有限期90,提前15天發警報提示 [root@localhost ~]# chage -E '2014-09-30' test # test這個賬號的有效期是2014-09-30
春有百花秋有月,夏有涼風冬有雪!