CHAGE - the command is used to change/show user's password related information like when it will expire, when it must be changed, when user should be warned to change the password etc.
FORMAT:
For root users:
chage [-D binddn] [-P path] [-m mindays]
[-M maxdays] [-d lastday] [-I inactive] [-E expiredate] [-W warndays] user
For normal user
chage -l [user]
DESCRIPTION
- chage is used to list and change the password expiry information of a user. It allows the system administrator to change the number of days between allowed and required password changes and the date of the last password change.
- It allows also to define when an account will expire.
chage -E 2016-03-31 student1
- CHAGE command is mostly an administrative level command. Besides a normal user can only list the password related information for himself/herself using -l option.
- If no option is given, chage operates in an interactive mode, prompting the user with the current values for all of the fields.
- You can enter new value or leave the line blank to use the current value.
- If the users exists in the local passwd file, but not in the local shadow file, chage will create a new entry in the shadow file.
Following are the options availabe for CHAGE:
-l, --list
- This option will list the password expiry information in a human readable format.
- The user will see the date when he changed the password the last time, when the password will be expire, when the password will be locked and when the account will expire.
-m, --mindays mindays
- With this option the minimum number of days between password changes is changed.
- A value of zero for this field indicates that the user may change her password at any time. Else the user will not be permitted to change the password until min days have elapsed.
#>chage -m 0 student1
Only an administrator is allowed to change aging information.
Note: You have to a root user to execute chage command except for listing (chage -l <user>).
-M, --maxdays maxdays
With this option the maximum number of days during which a password is valid is changed. When maxdays plus lastday is less than the current day, the user will be required to change his password before being able to use the account.
-d, --lastday lastday
With this option the date when the password was last changed can be set to another value. lastday has to be specified as number of days since January 1st, 1970. The date may also be expressed in the format YYYY-MM-DD.
If supported by the system, a value of zero forces the user to change the password at next login.
-W, --warndays warndays
With this option the number of days of warning before a password change is required can be changed. This option is the number of days prior to the password expiring that a user will be warned the password is about to expire.
-I, --inactive inactive
This option is used to set the number of days of inactivity after a password has expired before the account is locked. A user whose account is locked must contact the system administrator before being able to use the account again. A value of -1 disables this feature.
-P --path path
- Using this option we can ask chage to use another password files instead of regular /etc/passwd /etc/shadow files.
- This is useful for example on NIS master servers, where you do not want to give all users in the NIS database automatic access to your NIS server and the NIS map is build from special files.
|