How do I change the maximum number of days between password change?
-
Also see:
chage - change user password expiry information-M, --maxdays MAX_DAYS Set the maximum number of days during which a password is valid. When MAX_DAYS plus LAST_DAY is less than the current day, the user will be required to change their password before being able to use their account. This occurrence can be planned for in advance by use of the -W option, which provides the user with advance warning. Passing the number -1 as MAX_DAYS will remove checking a password's validity.
-W, --warndays WARN_DAYS Set the number of days of warning before a password change is required. The WARN_DAYS option is the number of days prior to the password expiring that a user will be warned his/her password is about to expire.
Check the user password expiry information.
$ sudo chage -l testuser Last password change : Mar 23, 2018 Password expires : never Password inactive : never Account expires : Jan 08, 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 : 7
Change the minimum number of days between password change to 30 days
$ sudo chage -M 120 testuser
Check again.
$ sudo chage -l testuser Last password change : Mar 23, 2018 Password expires : Jul 21, 2018 Password inactive : never Account expires : Jan 08, 1970 Minimum number of days between password change : 30 Maximum number of days between password change : 99999 Number of days of warning before password expires : 7
© Lightnetics 2024