linux密码即将过期

avatar 2020年6月24日20:24:55 评论 2,054 次浏览

密码过期时间系统有默认设置,一旦密码快要过期就需要更新密码。更新后的密码必须要和原密码不同,修改密码后如果密码的过期时间太短可以进行修改。下面先看一下即将过期的提醒,这是我使用ssh登录的时候提醒的内容:

You are required to change your password immediately (password aged)
Last login: Fri May 29 21:00:54 2020 from 10.16.202.178

Welcome to aliyun Elastic Compute Service!

WARNING: Your password has expired.
You must change your password now and login again!
Changing password for user suoper.
Changing password for suoper.
(current) UNIX password: 
New A+b+4+! password: 
Retype new A+b+4+! password: 
passwd: all authentication tokens updated successfully.

在(current) UNIX password: 里输入的是原密码,后面两次就是修改后的密码进行验证。验证通过显示更新成功。如果密码的过期时间太短可以修改

sed -i 's/PASS_MAX_DAYS\t60/PASS_MAX_DAYS\t180/g' /etc/login.defs

默认的是60天,修改成180天。这里使用到tab格式进行替换,sed替换的时候tab的字符串是"\t"。

avatar

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: