本文小編為大家詳細(xì)介紹“Linux中chage命令的語(yǔ)法是什么”,內(nèi)容詳細(xì),步驟清晰,細(xì)節(jié)處理妥當(dāng),希望這篇“Linux中chage命令的語(yǔ)法是什么”文章能幫助大家解決疑惑,下面跟著小編的思路慢慢深入,一起來(lái)學(xué)習(xí)新知識(shí)吧。
創(chuàng)新互聯(lián)主營(yíng)南縣網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營(yíng)網(wǎng)站建設(shè)方案,重慶APP開(kāi)發(fā)公司,南縣h5小程序設(shè)計(jì)搭建,南縣網(wǎng)站營(yíng)銷(xiāo)推廣歡迎南縣等地區(qū)企業(yè)咨詢
linux chage命令簡(jiǎn)介:
chage命令用于密碼實(shí)效管理,該是用來(lái)修改帳號(hào)和密碼的有效期限。它可以修改賬號(hào)和密碼的有效期。對(duì)于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
命令語(yǔ)法:
chage [options] user
命令參數(shù):
參數(shù) | 描敘 |
-d | 指定密碼最后修改日期 |
-e | 密碼到期的日期,過(guò)了這天,此賬號(hào)將不可用。0表示馬上過(guò)期,-1表示永不過(guò)期。 |
-h | 顯示幫助信息并退出 |
-i | 密碼過(guò)期后,鎖定賬號(hào)的天數(shù) |
-l | 列出用戶以及密碼的有效期 |
-m | 密碼可以更改的最小天數(shù)。為零代表任何時(shí)候都可以更改密碼。 |
-m | 密碼保持有效的最大天數(shù)。 |
-w | 密碼過(guò)期前,提前收到警告信息的天數(shù)。 |
使用示例:
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 expires : -1
[root@db-server ~]#
3:設(shè)置mysql用戶60天后密碼過(guò)期,至少7天后才能修改密碼,密碼過(guò)期前7天開(kāi)始收到告警信息。
[root@db-server ~]# chage -m 60 -m 7 -w 7 mysql
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
4:強(qiáng)制新建用戶第一次登陸時(shí)修改密碼
[root@db-server home]# useradd test
[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
下面給大家介紹linux chage命令
功能:修改帳號(hào)和密碼的有效期限
用法:chage[-l][-m mindays][-m maxdays][-i inactive][-e expiredate][-w warndays][-d lastdays]username
參數(shù):
-l:列出用戶的以及密碼的有效期限
-m:修改密碼的最小天數(shù)
-m:修改密碼的最大天數(shù)
-i:密碼過(guò)期后,鎖定帳號(hào)的天數(shù)
-d:指定密碼最后修改的日期
-e:有效期,0表示立即過(guò)期,-1表示永不過(guò)期
-w:密碼過(guò)期前,開(kāi)始警告天數(shù)
讀到這里,這篇“Linux中chage命令的語(yǔ)法是什么”文章已經(jīng)介紹完畢,想要掌握這篇文章的知識(shí)點(diǎn)還需要大家自己動(dòng)手實(shí)踐使用過(guò)才能領(lǐng)會(huì),如果想了解更多相關(guān)內(nèi)容的文章,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。