使用 chage 更新 linux 用户密码过期时间
chage
,其实很好记,就是 change age
。主要用于更新和 linux 用户相关的各种过期信息,比如 账号过期时间
,密码过期时间
等,具体参数如下:
[root@VM_61_237_centos ~]# chage --help
Usage: chage [options] LOGIN
Options:
-d, --lastday LAST_DAY set date of 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
-R, --root CHROOT_DIR directory to chroot into
-W, --warndays WARN_DAYS set expiration warning days to WARN_DAYS
[root@VM_61_237_centos ~]#
其中 -l
选项可以查看用户当前的过期信息:
[root@VM_61_237_centos ~]# chage -l root
Last password change : Jun 08, 2018
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@VM_61_237_centos ~]#
和命令参数的对比之下,那个参数有什么用就一目了然了。