Linux 基础命令 -- chage

命令介绍

命令:chage 管理用户密码时效问题

用法:chage [options] LOGIN chage 用户

命令选项

[root@fp-21 ~]# chage
 
  -d, --lastday LAST_DAY        # 指定日期为最近一次密码修改时间
  -E, --expiredate EXPIRE_DATE  # 指定日期为用户密码过期时间
  -h, --help                    # 帮助文档
  -I, --inactive INACTIVE       # 密码过期后,设置为失效
  -l, --list                    # 显示用户密码信息
  -m, --mindays MIN_DAYS        # 设置两次更改密码之间的最短天数
  -M, --maxdays MAX_DAYS        # 设置两次更改密码之间的最长天数
  -W, --warndays WARN_DAYS      # 设置密码失效前的警告天数

命令实例

# 指定日期为最近一次密码修改时间
[root@fp-21 ~]# chage -d 2020/2/15 tom
[root@fp-21 ~]# chage -l tom
Last password change					: Feb 15, 2020
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

# 指定日期为用户密码过期时间
[root@fp-21 ~]# chage -E 2020/2/20 tom
[root@fp-21 ~]# chage -l tom
Last password change					: Feb 15, 2020
Password expires					: never
Password inactive					: never
Account expires						: Feb 20, 2020
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

# 显示用户密码信息
[root@fp-21 ~]# chage -l tom
Last password change					: Feb 15, 2020
Password expires					: never
Password inactive					: never
Account expires						: Feb 20, 2020
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


# 设置两次更改密码之间的最短天数
[root@fp-21 ~]# chage -m 1 tom
[root@fp-21 ~]# chage -l tom
Last password change					: Feb 15, 2020
Password expires					: never
Password inactive					: never
Account expires						: Feb 20, 2020
Minimum number of days between password change		: 1
Maximum number of days between password change		: 99999
Number of days of warning before password expires	: 7

# 设置两次更改密码之间的最长天数
[root@fp-21 ~]# chage -M 10 tom
[root@fp-21 ~]# chage -l tom
Last password change					: Feb 15, 2020
Password expires					: Feb 25, 2020
Password inactive					: never
Account expires						: Feb 20, 2020
Minimum number of days between password change		: 1
Maximum number of days between password change		: 10
Number of days of warning before password expires	: 7

# 设置密码失效前的警告天数
[root@fp-21 ~]# chage -W 3 tom
[root@fp-21 ~]# chage -l tom
Last password change					: Feb 15, 2020
Password expires					: Feb 25, 2020
Password inactive					: never
Account expires						: Feb 20, 2020
Minimum number of days between password change		: 1
Maximum number of days between password change		: 10
Number of days of warning before password expires	: 3

link 查看 Linux 基础命令

只有注入思想的博客才是好的博客

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值