Setting Passwords that Expire in Linux
January30
The /etc/login.defs file controls the parameters we are interested in changing inorder to enable or disable passwords that expire in Linux. It contains a number of other configuration setting for user accounts on your machine. The following are the ones that we are interested in.
- PASS_MAX_DAYS: Maximum number of days a password may be used. It controls how often users must change their passwords. Any passwords older than this will force the user to change their password the next time they login. To disable set to 99999.
- PASS_MIN_DAYS: Minimum number of days allowed between password changes.This prevents people from changing their password 5 times in one day. To disable set to 0.
- PASS_MIN_LEN: Minimum acceptable password length. No short passwords will be accepted. 8 characters is a recommended length.
- PASS_WARN_AGE: Number of days warning given before a password expires.
open the file /etc/login.defs using your favorite text editor.
# vi /etc/login.defs
edit the file (sample):
PASS_MAX_DAYS 90
PASS_MIN_DAYS 0
PASS_MIN_LEN 8
PASS_WARN_AGE 7
Save the file.