I want to set Maximum days of a password can be used.
So I configure PASS_MAX_DAYS
in /etc/login.defs
, and PASS_WARN_AGE to warn user before the password expired. In my example, I set PASS_MAX_DAYS = 2, and PASS_WARN_AGE = 1. So the password will be expired in two days, and I will get warning of password expiring in 1 day.
So my configure in /etc/login.defs is:
PASS_MAX_DAYS 2
PASS_MIN_DAYS 0
PASS_MIN_LEN 8
PASS_WARN_AGE 1
But the problem is, when 2 days coming, I will get warn information:
Warning: your password will expire in 0 days
But I can still login with my old password, and the system doesn't force me to change the password. Besides, the password is not the one of root account.
Why the system doesn't force me to change password when the expire days coming? How to configure the system to make password maximum days take effective? Could anyone help me with this? Thanks!
Have you create the account before or after you made the changes to the login.defs file if it was after then you still need to change the account data using chage:
You may want to check
/etc/default/useradd
aswell and change theINACTIVE=
to 2