To ensure user security, you need to set the validity period of a user. You can run the chage command to set the validity period of a user.
Command:
chage [-m mindays] [-M maxdays] [-d lastday] [-I inactive] [-E expiredate] [-W warndays] user
Table 1 describes the parameters.
Parameter |
Description |
|---|---|
-m |
Minimum time (in days) for which the password must be used. The password cannot be changed during this period. The value 0 indicates that the password can be changed at any time. |
-M |
Maximum validity period (days) of a password. The value -1 indicates that the validity check of the password can be disabled. The value 99999 indicates that the validity period is unlimited. |
-d |
Date when the password was changed the last time. |
-I |
Maximum idle period (in days) after which the user account will be disabled. After the specified time period has expired, the password will be invalid. |
-E |
Date when the user account expires. The user account is unavailable when the account validity period has expired. |
-W |
Number of days in advance users are notified that their passwords are about to expire. |
-l |
Lists the current settings. It helps non-privileged users to determine the time when their passwords or accounts expire. |
For example, to change the validity period of user test to December 31, 2017, run the following command:
chage -M 90 test