每天一个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协议族中 ...
随机推荐
- BTE的一些知识
1.今天遇到一个问题,看项目上做了BTE增强00001120 事件的BTE 但是自定义函数 更改了参数 t_bseg t_bkpf MODIFY t_bkpf FROM ls_bkpf TRAN ...
- hdfs操作命令
文件操作命令:hdfs dfs -ls /hdfs dfs -mkdir /hdfs dfs -rm -rf /hdfshdfs dfs -duhdfs dfs -get /hdfs /localhd ...
- swift 第十三课 GCD 的介绍和使用
手头的项目中基本没有用到这个,但是还是要探索下.毕竟好多的地方要用这个,而且现在手机和电脑等电子设备都是多核心的,这样就成就了多线程带来更加优越的用户体验. 先记录下,自己看到的两个不错的连接: ht ...
- Unity-3D-H2
1.简答题[建议做解释 游戏对象(GameObjects) 和 资源(Assets)的区别与联系. 游戏对象:直接出现在游戏的场景中,是资源整合的具体表现,对象通过层次结构来组织,通过整体-部分的关系 ...
- ffmpeg学习笔记-native原生绘制
上次已将ffmpeg的动态库编译出来了,并且使用了ffmpeg的转码功能,成功将mp4格式视频转化为yuv视频,这篇文章基于上次测试的demo,使用surfaceview显示解码完成的像素数据 布局设 ...
- HDU 6470 【矩阵快速幂】
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6470 写这道题是为了让自己不要忘记矩阵快速幂如何推出矩阵式子的. 注意 代码是TLE的!! #incl ...
- PTA(Advanced Level)1050.String Subtraction
Given two strings S1 and S2, S=S1−S2 is defined to be the remaining string after taking all the char ...
- [转帖]「知乎知识库」— 5G
「知乎知识库」— 5G 甜草莓 https://zhuanlan.zhihu.com/p/55998832 通信 话题的优秀回答者 已关注 881 人赞同了该文章 谢 知识库 邀请~本文章是几个答 ...
- centos7ping www.baidu.com没有ping通
在linux中ping www.baidu.com 无法ping通,可能原因是DNS没配置好 1.修改vi /etc/resolv.conf 增加如下内容: nameserver 114.114.11 ...
- 什么是阿里云CDN
阿里云内容分发网络(Content Delivery Network,简称CDN)是建立并覆盖在承载网之上,由分布在不同区域的边缘节点服务器群组成的分布式网络.阿里云CDN分担源站压力,避免网络拥塞, ...