Linux中chage命令的语法是什么
时间:2023-05-15 21:40
linux chage命令简介: 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 [options] user 命令参数: 参数 描叙 -d 指定密码最后修改日期 -e 密码到期的日期,过了这天,此账号将不可用。0表示马上过期,-1表示永不过期。 -h 显示帮助信息并退出 -i 密码过期后,锁定账号的天数 -l 列出用户以及密码的有效期 -m 密码可以更改的最小天数。为零代表任何时候都可以更改密码。 -m 密码保持有效的最大天数。 -w 密码过期前,提前收到警告信息的天数。 使用示例: 1: 查看chage命令的帮助信息 [root@db-server ~]#man chage options: -d, --lastday last_day set last password change to last_day 2:查看mysql用户以及密码的有效期 [root@db-server ~]# chage -l mysql 3:设置mysql用户60天后密码过期,至少7天后才能修改密码,密码过期前7天开始收到告警信息。 [root@db-server ~]# chage -m 60 -m 7 -w 7 mysql 4:强制新建用户第一次登陆时修改密码 [root@db-server home]# useradd test 下面给大家介绍linux chage命令 功能:修改帐号和密码的有效期限 用法:chage[-l][-m mindays][-m maxdays][-i inactive][-e expiredate][-w warndays][-d lastdays]username 参数: -l:列出用户的以及密码的有效期限 以上就是Linux中chage命令的语法是什么的详细内容,更多请关注Gxl网其它相关文章!
[root@db-server ~]# info chage
[root@db-server ~]# chage -h
usage: chage [options] user
-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
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 expires : -1
[root@db-server ~]#
you have new mail in /var/spool/mail/root
[root@db-server ~]# chage -l mysql
last password change : mar 26, 2015
password expires : may 25, 2015
password inactive : never
account expires : never
minimum number of days between password change : 7
maximum number of days between password change : 60
number of days of warning before password expires : 7
[root@db-server ~]#
clip_image001
[root@db-server home]# passwd test
changing password for user test.
new unix password:
retype new unix password:
passwd: all authentication tokens updated successfully.
[root@db-server home]# chage -d 0 test
you have new mail in /var/spool/mail/root
[root@db-server home]# chage -l test
last password change : password must be changed
password expires : never
password inactive : never
account expires : never
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
-m:修改密码的最小天数
-m:修改密码的最大天数
-i:密码过期后,锁定帐号的天数
-d:指定密码最后修改的日期
-e:有效期,0表示立即过期,-1表示永不过期
-w:密码过期前,开始警告天数