標籤:des style color os io 使用 java strong ar
CHAGE(1) 使用者命令 CHAGE(1)
名稱
chage - 更改使用者密碼到期資訊
大綱
chage [選項] 登入
描述
The chage command changes the number of days between password changes and the date of the last password change. This information is used by
the system to determine when a user must change his/her password.
選項
chage 命令可以接受的選項有:
********************************************************************************************************************
-m, --mindaysMIN_DAYS
在密碼更改之間的最小天數設定為 MIN_DAYS。此欄位中的 0 值表示使用者可以在任何時間更改其密碼。
-M, --maxdaysMAX_DAYS
Set the maximum number of days during which a password is valid. When MAX_DAYS plus LAST_DAY is less than the current day, the user will
be required to change his/her password before being able to use his/her account. This occurrence can be planned for in advance by use of
the -W option, which provides the user with advance warning.
MAX_DAYS 設定為 -1 會移除密碼有效性檢查。
-E, --expiredateEXPIRE_DATE #賬戶失效日期,不同於 passwd 中的 -e or -x 選項,後者指密碼失效日期
Set the date or number of days since January 1, 1970 on which the user‘s account will no longer be accessible. The date may also be
expressed in the format YYYY-MM-DD (or the format more commonly used in your area). A user whose account is locked must contact the
system administrator before being able to use the system again.
EXPIRE_DATE 設定為 -1 會移除賬戶的到期日期。
-W, --warndaysWARN_DAYS
Set the number of days of warning before a password change is required. The WARN_DAYS option is the number of days prior to the password
expiring that a user will be warned his/her password is about to expire.
-I, --inactiveINACTIVE #決定密碼失效日期
Set the number of days of inactivity after a password has expired before the account is locked. The INACTIVE option is the number of
days of inactivity. A user whose account is locked must contact the system administrator before being able to use the system again.
密碼的到期時間只能由 passwd -x N or passwd -e 修改,賬戶的失效日期只能由 chage -E YYYY-MM-DD修改
在指定最小天數的選項,兩者也不相同,passwd -n N , chage -m N1 -M N2
*************************************************************************************************************************
-d, --lastdayLAST_DAY
Set the number of days since January 1st, 1970 when the password was last changed. The date may also be expressed in the format
YYYY-MM-DD (or the format more commonly used in your area).
-l, --list
現實賬戶年齡資訊。
# 在passwd 中這個選項是Lock
#替代者為 -S (status)
-h, --help
現實協助資訊並退出。
INACTIVE 設定為 -1 會移除賬戶禁用功能。
-R, --rootCHROOT_DIR
Apply changes in the CHROOT_DIR directory and use the configuration files from the CHROOT_DIR directory.
如果沒有選擇任何選項,chage 會進入互動模式,以所有欄位的當前值提示使用者。輸入一個新值可以更改這些欄位,或者留空使用當前值。當前值出現在 [ ]
標記對裡。
注意
chage 需要有一個影子密碼檔案才可用。
只有 root 才可以使用 chage,一個特殊情況是 -l 選項,用來讓非特權使用者覺得自己的密碼或賬戶何時到期。
設定檔
在 /etc/login.defs 中有如下組態變數,可以用來更改此工具的行為:
檔案
/etc/passwd
使用者賬戶資訊。
/etc/shadow
安全使用者賬戶資訊。
退出值
chage 命令有如下退出值:
0
成功
1
2
無效的命令文法
15
無法找到影子密碼檔案
參見
passwd(5), shadow(5).
shadow-utils 4.1.5.1 2014-02-17 CHAGE(1)
Linux -- chage