chage command in Linux allows users to change and view the user password and expiry details. Means, this command can be used to offer login details to a user for a specified time limit, and after the limit crosses, the password expires automatically. Also, this command helps users to change the login password when necessary. In addition to these, the command can also be helpful to view an account aging details like date when the password was previously altered, set the password changing time, lock an account after certain amount of time, and so on.
Syntax of chage command in Linux
chage [options] Account_Login_Name
Options available to use with chage command
- -l: Used to display statistics of changing account information.
- -d: Used for modifying current expiry date status.
- -E: Used to set the password expiry date of the account.
- -M: Used to set the maximum number of days in which the password can be changed.
- -I: Used for setting the limit of days, after which the user can change he password during its inactivity period.
- -W: Used to set the warning alarm before the account gets locked.
- -h: Displays help information and exits.
Examples of chage command
1: Displaying statics of changing account information for a user.
chage -l user_name
2: Modifying current expiry date of a user
chage -d yyyy-mm-dd user_name
3: Setting the password expiry date of a user
chage -E yyyy-mm-dd user_name
4: Setting max number of days for user’s password to be changed
chage -M [number] user_name
Nishant Verma is a senior web developer who love to share his knowledge about Linux, SysAdmin, and more other web handlers. Currently, he loves to write as content contributor for ServoNode.