linux学习笔记--chage命令

修改帐号和密码的有效期限

永久修改路径: /etc/login.defs

# Password aging controls:
#
#       PASS_MAX_DAYS   Maximum number of days a password may be used.
#       PASS_MIN_DAYS   Minimum number of days allowed between password changes.
#       PASS_MIN_LEN    Minimum acceptable password length.
#       PASS_WARN_AGE   Number of days warning given before a password expires.
#
PASS_MAX_DAYS   99999
PASS_MIN_DAYS   0   
PASS_MIN_LEN    5   
PASS_WARN_AGE   7 

-l:列出具体信息

[root@localhost ~]# chage -l root
Last password change					: Feb 21, 2016
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

-m:密码可更改的最小天数。0:任何时候都可以更改密码

[root@localhost ~]# chage -m 5 root
-M:密码保持有效的最大天数

[root@localhost ~]# chage -M 60 root

-W:用户密码到期前,提前收到警告的天数

[root@localhost ~]# chage -W 10 root

-E:账户到期的日期,过了这天,此帐号无法使用(-1为never)

[root@localhost ~]# chage -E 10 root
[root@localhost ~]# chage -l root
Last password change					: Feb 21, 2016
Password expires					: never
Password inactive					: never
Account expires						: Jan 11, 1970
Minimum number of days between password change		: 0
Maximum number of days between password change		: 99999
Number of days of warning before password expires	: 10

-d:上一次更改的日期

[root@localhost ~]# chage -d 2016-11-10 root
[root@localhost ~]# chage -l root
Last password change					: Nov 10, 2016
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	: 10

-i:停滞时间。如果密码已经过期这些天,那么这个帐号将不可用

[root@localhost ~]# chage -I -1 root



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值