×



chage stands for "Change Age", which is used to view and edit password change time information, setting account status, change the expiry date of the account in a Linux system. Basically, We must change password information regularly to ensure security, especially for administrators.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Linux system administration queries.

In this context, we shall look into how to use the Linux chage command as well its examples.


What is the syntax of Linux chage command ?

chage command's syntax is given below:

$ chage [options] LOGIN

Its Options is explained below:

-l display the expiry information. For example, I want to check the expiry information of "ubuntu":

$ chage -l ubuntu


-d change the expiry information. Now I want to specify the expiration date of "ubuntu" as of August 30, 2021: $ sudo chage -d 2021-08-30 ubuntu. Then use chage command with -l option to check:

$ chage -l ubuntu

You will notice that the expiry date has changed.


-E lock the account. For example: $ sudo chage -E 2023-06-30 ubuntu

Then use chage command with -l option to check: $ chage -l ubuntu

Now the account will be locked on Jun 30, 2023.


-M set maximum time before the password can be changed. We want to set the value as 365: $ sudo chage -M 365 ubuntu

Then use chage command with -l option to check: $ chage -l ubuntu


-I limit the date to change the password

For example, if we want to set the value as 30, we simply run the below command:

$ sudo chage -I 30 ubuntu

Then use chage command with -l option to check:

$ chage -l ubuntu


-W set a warning alarm. By default, it will warn 7 days in advance. If we want to set the value as 3, then we run the below command:

$ sudo chage -W 5 ubuntu

Then use chage command with -l option to check:

$ chage -l ubuntu


-h display help information. To display the help information relating to this command, simply execute the below command:

$ chage -h


[Need assistance in fixing Linux System Software Installation issues? Notify us. ]


Conclusion


More Linux Tutorials

We create Linux HowTos and Tutorials for Sys Admins. Visit us on IbmiMedia.com

Also for Tech related tips, Visit forum.outsourcepath.com or General Technical tips on www.outsourcepath.com