How to Use the “Change” Command in Linux
Using the Linux chage
Command
The chage
command is a powerful Linux tool used to change and manage user password aging information. It can be used to set expiration dates on user accounts, configure password expiration warnings and more. In this article, we’ll go over how to use the chage
command and explain some of its most useful options.
Basic Syntax of the chage
Command
The basic syntax for the chage
command is as follows:
chage [option] [username]
For example, to view the currently configured password aging information for a user named “bob”, you could run the command:
chage -l bob
Common Options for the chage
Command
There are a number of different options that can be used with the chage
command. Here are some of the most common ones:
-d, --lastday
: This option sets the date of the user’s last password change.-E, --expiredate
: This option sets the date on which the user’s password will expire.-M, --mindays
: This option sets the minimum number of days between password changes.-W, --warndays
: This option sets the number of days prior to the password expiry when the user should receive warnings.
For more options and usage examples, check out the official man page.
Conclusion
In this article, we explained how to use the chage
command on a Linux system. We covered some of the command’s most common options and showed how to use them to manage user password aging information. Be sure to check out the official man page for more details and usage examples.