每天一个Linux命令之: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
[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 ,
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : -
Maximum number of days between password change : -
Number of days of warning before password expires : -
3:设置mysql用户60天后密码过期,至少7天后才能修改密码,密码过期前7天开始收到告警信息。
[root@DB-Server ~]# chage -M -m -W mysql
You have new mail in /var/spool/mail/root
[root@DB-Server ~]# chage -l mysql
Last password change : Mar ,
Password expires : May ,
Password inactive : never
Account expires : never
Minimum number of days between password change :
Maximum number of days between password change :
Number of days of warning before password expires :
4:强制新建用户第一次登陆时修改密码
[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 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 :
Maximum number of days between password change :
Number of days of warning before password expires :
每天一个Linux命令之:chage的更多相关文章
- 每天一个 Linux 命令(21):find命令之xargs
在使用 find命令的-exec选项处理匹配到的文件时, find命令将所有匹配到的文件一起传递给exec执行.但有些系统对能够传递给exec的命令长度有限制,这样在find命令运行几分钟之后,就会出 ...
- 每天一个linux命令(25):linux文件属性详解
Linux 文件或目录的属性主要包括:文件或目录的节点.种类.权限模式.链接数量.所归属的用户和用户组.最近访问或修改的时间等内容.具体情况如下: 命令: ls -lih 输出: [root@loca ...
- 每天一个linux命令(46):vmstat命令
vmstat是Virtual Meomory Statistics(虚拟内存统计)的缩写,可对操作系统的虚拟内存.进程.CPU活动进行监控.他是对系统的整体情况进行统计,不足之处是无法对某个进程进行深 ...
- 每天一个linux命令目录
出处:http://www.cnblogs.com/peida/archive/2012/12/05/2803591.html 开始详细系统的学习linux常用命令,坚持每天一个命令,所以这个系列为每 ...
- 每天一个 Linux 命令(20):find命令之exec
find是我们很常用的一个Linux命令,但是我们一般查找出来的并不仅仅是看看而已,还会有进一步的操作,这个时候exec的作用就显现出来了. exec解释: -exec 参数后面跟的是command ...
- 每天一个linux命令(20):find命令之exec
find是我们很常用的一个Linux命令,但是我们一般查找出来的并不仅仅是看看而已,还会有进一步的操作,这个时候exec的作用就显现出来了. exec解释: -exec 参数后面跟的是command ...
- 每天一个Linux命令
每天一个Linux命令(1):ls命令 每天一个Linux命令(2):cd命令 每天一个Linux命令(3):pwd命令 每天一个 Linux 命令(4):mkdir 每天一个 Linux 命令(5) ...
- 每天一个linux命令-转载
每天一个linux命令目录 转载自: http://www.cnblogs.com/peida/archive/2012/12/05/2803591.html 开始详细系统的学习linux常用命令 ...
- [转]每天一个linux命令目录
[转]每天一个linux命令目录 http://www.cnblogs.com/peida/archive/2012/12/05/2803591.html 开始详细系统的学习linux常用命令,坚持每 ...
- 每天一个linux命令(45)--telnet命令
每天一个Linux命令,今天是网络命令中的Telnet. Telnet 命令通常用来远程登录,Telnet 程序是基于 Telnet 协议的远程登录客户端程序.Telnet 协议是TCP/IP协议族中 ...
随机推荐
- JMeter 不同线程组间变量传递(亲测 ok)
JMeter元件都是有作用域的,而变量大多使用正则表达式提取器,要想在不通过线程组件使用变量参数,则需要设置全部变量 JMeter函数助手就提供了一个函数用于设置全局变量属性,实现的功能类似于在用户自 ...
- ElasticSearch——集群搭建
1.准备 1.1.组件 JDK:1.8版本及以上: ElasticSearch:6.2.4版本: 1.2.服务器 3台服务器 2.安装 2.1.下载解压 wget https://artifacts. ...
- opengl球形网格生成
效果如图 准备第三方库 glew.freeglut.glm 代码包括主程序源文件mainApp.cpp.顶点着色器shader.vs.片元着色器shader.fs mainApp.cpp如下 #i ...
- 02.01Linux中软件的安装、环境搭建
图1 图2 图3 redis安装 图4 =====================linux下的软件的安装====================安装方式:Yum/rpm/源码安装yum:通过分析rp ...
- 【FFMPEG】VS2015编译FFMPEG
系统环境:Windows 10 64位 需要安装的软件和工具: Visual Studio 2015 With Update 3 MSYS2 YASM 一.VS2015 安装VS2015时,选择 ...
- 【VS开发】QueryPerformanceFrequency与QueryPerformanceCounter的使用
LARGE_INTEGER tima,timb; QueryPerformanceCounter(&tima); 在 Windows Server 2003 和 WindowsXP 中使用 Q ...
- mongodb的安装部署-备份
1.安装部署 wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.4.10.tgz tar -zxf mongodb-linux- ...
- thinkphp5相关
THINKPHP5代码风格规范(基于PSR): https://www.jianshu.com/p/e53d26407e68
- Linux系统下GDB调试
GDB 一.gdb常用命令: 命令 描述 backtrace(或bt) 查看各级函数调用及参数 finish 连续运行到当前函数返回为止,然后停下来等待命令 frame(或f) 帧编号 选择栈帧 in ...
- java SerialPort串口通讯的使用
api文档 http://fazecast.github.io/jSerialComm/javadoc/com/fazecast/jSerialComm/package-summary.html ma ...