linux chage命令简介:
chage用于密码实效管理,该是用来修改帐号和密码的有效期限它可以修改账号和密码的有效期对于CHAGE命令的描述如下所示。:
chage命令更改密码更改与上次密码更改日期之间的天数。系统使用此信息来确定用户何时必须更改其密码
命令语法:
chage [options] 用户
命令参数:
参数 | 描述 |
-d | 指定密码最后修改日期 |
-E | 密码到期的日期,过了这天,此账号将不可用,0表示马上过期,-1表示永不过期 |
-h | 显示帮助信息并退出 |
-I | 密码过期后,锁定账号的天数 |
-l | 列出用户及密码的有效期 |
-m | 密码可更改的最小天数。为零代表任何时候都可以更改密码 |
-M | 密码保持有效的最大天数 |
-W | 密码过期前,提前收到警告信息的天数 |
使用示例:
1: 查看chage命令的帮助信息
[root@DB-Server ~]#man chage
[root@DB-Server ~]# info chage
[root@DB-Server ~]# chage -h
Usage: chage [options] user
Options:
-d, --lastday LAST_DAY set last password change to LAST_DAY
-E, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
-h, --help display this help message and exit
-I, --inactive INACTIVE set password inactive after expiration
to INACTIVE
-l, --list show account aging information
-m, --mindays MIN_DAYS set minimum number of days before password
change to MIN_DAYS
-M, --maxdays MAX_DAYS set maximim number of days before password
change to MAX_DAYS
-W, --warndays WARN_DAYS set expiration warning days to WARN_DAYS
2:查看mysql用户以及密码的有效期
[root@DB-Server ~]# chage -l mysql
Last password change : Mar 26, 2015
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : -1
Maximum number of days between password change : -1
Number of days of warning before password exp
1: 查看chage命令的帮助信息
[root@DB-Server ~]#man chage
[root@DB-Server ~]# info chage
[root@DB-Server ~]# chage -h
Usage: chage [options] user
Options:
-d, --lastday LAST_DAY set last password change to LAST_DAY
-E, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
-h, --help display this help message and exit
-I, --inactive INACTIVE set password inactive after expiration
to INACTIVE
-l, --list show account aging information
-m, --mindays MIN_DAYS set minimum number of days before password
change to MIN_DAYS
-M, --maxdays MAX_DAYS set maximim number of days before password
change to MAX_DAYS
-W, --warndays WARN_DAYS set expiration warning days to WARN_DAYS
2:查看mysql用户以及密码的有效期
[root@DB-Server ~]# chage -l mysql
Last password change : Mar 26, 2015
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : -1
Maximum number of days between password change : -1
Number of days of warning before password exp