加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

Linux(CentOS)用户修改密码有效期(chage命令)

发布时间:2020-12-14 01:56:25 所属栏目:Linux 来源:网络整理
导读:Linux设置用户密码的有效期限 ? 解决: ??????? 先查看密码过期时间,现在是90天? ? 1 2 3 4 5 6 7 8 [[email?protected] ~] # chage -l testuser Last password change???? : Jul 10,2017 Password expires???? : Oct 08,2018 Password inactive???? : neve

Linux设置用户密码的有效期限

?

解决:

??????? 先查看密码过期时间,现在是90天? ?

1
2
3
4
5
6
7
8
[[email?protected] ~] # chage -l testuser
Last password change???? : Jul 10,2017
Password expires???? : Oct 08,2018
Password inactive???? : never
Account expires???? : never
Minimum number of days between password change???? : 0
Maximum number of days between password change???? : 90
Number of days of warning before password expires??? : 10

  

  用命令修改过期时间为永久,然后查看Password expires?? : never?? 和? Maximum number of days between password change? : 99999修改成功

1
2
3
4
5
6
7
8
9
[[email?protected] ~] # chage -M 99999 testuser
[[email?protected] ~] # chage -l testuser
Last password change??????????????????? : Jul 10,2017
Password expires??????????????????? : never
Password inactive??????????????????? : never
Account expires??????????????????????? : Oct 16,2243
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

 补充知识===================?chage命令用法:? ================================================

 

chage:密码失效是通过此命令来管理的。
 
  参数意思:
  -m 密码可更改的最小天数。为零时代表任何时候都可以更改密码。
  -M 密码保持有效的最大天数。
  -W 用户密码到期前,提前收到警告信息的天数。
  -E 帐号到期的日期。过了这天,此帐号将不可用。
  -d 上一次更改的日期
  -I 停滞时期。如果一个密码已过期这些天,那么此帐号将不可用。
  -l 例出当前的设置。由非特权用户来确定他们的密码或帐号何时过期。

[[email?protected] ~]# chage -l test      #查看用户密码设定情况
最近一次密码修改时间                                    :  4月 27,2018
密码过期时间                                    : 从不
密码失效时间                                    : 从不
帐户过期时间                                            : 从不
两次改变密码之间相距的最小天数          :-1
两次改变密码之间相距的最大天数          :-1
在密码过期之前警告的天数        :-1
 
[[email?protected] ~]# chage -M 90 test        #密码有效期90天
 
[[email?protected] ~]# chage -d 0 test       #强制用户登陆时修改口令
 
[[email?protected] ~]# chage -d 0 -m 0 -M 90 -W 15 test   #强制用户下次登陆时修改密码,并且设置密码最低有效期0和最高有限期90,提前15天发警报提示
 
[[email?protected] ~]# chage -E ‘2014-09-30‘ test  # test这个账号的有效期是2014-09-30

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读