我想将密码过期更改为非过期,为此我使用了以下命令
[root@test-host ~]# chage -l test
Last password change : password must be changed
Password expires : password must be changed
Password inactive : password must be changed
Account expires : never
Minimum number of days between password change : 0
chage -m 0 -M 99999 -I -1 -E -1 test
[root@test-host ~]# chage -l test
Last password change : Jun 10, 2017
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
但是,尽管它现在处于非过期状态,但它要求我更改密码。所以无论如何都要在过期后禁止更改现有密码
test@test-host's password:
You are required to change your password immediately (root enforced)
Last login: Wed Jun 14 01:28:07 2017 from
WARNING: Your password has expired.
You must change your password now and login again!
Changing password for user test.
Changing password for test.
答案1
你有没有尝试过:
passwd -x -1 -n -1 -w -1 ${USER}
它可能会产生相同的结果,但它可以达到目的。