chage命令
来源:原创 更新时间:2018-08-23 17:17:25 作者:管理员 浏览:1861
- 命令描述
- 命令语法
- 命令选项
-E (user)是账户的失效时间
-m (number) (ueser)是用户密码最短修改时间在这个天数之内无法修改密码。
-M (number) (ueser)是设置密码最长使用时间,还有几天超过这个时间必须修改密码。
-W (number) (ueser)是设置密码过期前的提醒时间默认是7天。
-I (number) (ueser)是密码过期后多少天之后账户失效。
-l (user)是查看用户密码状态的命令。
- 命令参数
- 命令实例
实例1:显示用户密码状态信息
[root@linuxbaodian linuxbaodian]# chage -l linuxbaodian Last password change : Aug 22, 2018 Password expires : never Password inactive : never Account expires : Aug 27, 2018 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
实例2:设置用户账户的失效日期
[root@linuxbaodian linuxbaodian]# chage -l linuxbaodian Last password change : Aug 22, 2018 Password expires : never Password inactive : never Account expires : Aug 08, 2108 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
实例3:设置账户到期10天后过期
[root@linuxbaodian linuxbaodian]# chage -I 10 linuxbaodian [root@linuxbaodian linuxbaodian]# grep 'linuxbaodian' /etc/shadowlinuxbaodian:$6$tLuiDywS$s3cw5Fhp/IpINCXH3bi04OBrt1bc3gmDVvp/qWq0eNAJfZbo.oMEcEM6c4NUEZlzIpQOK8eHsJk5XAFL1T73Z1:17765:0:99999:7:10:50623:
实例4:设置密码更改最少天数:180天 密码更改的最大天数:360天
[root@linuxbaodian linuxbaodian]# chage -m 180 -M 360 linuxbaodian [root@linuxbaodian linuxbaodian]# chage -l linuxbaodian Last password change : Aug 22, 2018 Password expires : Aug 17, 2019 Password inactive : Aug 27, 2019 Account expires : Aug 08, 2108 Minimum number of days between password change : 180 Maximum number of days between password change : 360 Number of days of warning before password expires : 7
实例5:该用户下次登录需要重新设置密码
[root@linuxbaodian linuxbaodian]# chage -d 0 linuxbaodian [root@linuxbaodian linuxbaodian]# grep linuxbaodian /etc/shadowlinuxbaodian:$6$tLuiDywS$s3cw5Fhp/IpINCXH3bi04OBrt1bc3gmDVvp/qWq0eNAJfZbo.oMEcEM6c4NUEZlzIpQOK8eHsJk5XAFL1T73Z1:0:180:360:7:10:50623:
实例6:设置用户下次修改密码的时间
[root@linuxbaodian linuxbaodian]# chage -d 2018-09-01 linuxbaodian [root@linuxbaodian linuxbaodian]# grep linuxbaodian /etc/shadow linuxbaodian:$6$tLuiDywS$s3cw5Fhp/IpINCXH3bi04OBrt1bc3gmDVvp/qWq0eNAJfZbo.oMEcEM6c4NUEZlzIpQOK8eHsJk5XAFL1T73Z1:17775:180:360:7:10:50623: