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 基础命令

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

发布了24 篇原创文章 · 获赞 76 · 访问量 3225

猜你喜欢

转载自blog.csdn.net/xtlhxl/article/details/104344796