首页 > 代码库 > Linux -- chage

Linux -- chage

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