chage
chage
The chage
command in Linux is used to change the password aging information for user accounts. Password aging is a security feature that allows you to specify how often users must change their passwords and how long their passwords are valid before they expire.
The chage
command is used in the following syntax:
The options
can be used to specify the following:
-M
: Set the minimum number of days between password changes.-W
: Set the number of days after a password expires before the account is locked.-I
: Set the number of days of inactivity after which a password will expire.-E
: Set the date after which the account will expire.-l
: List the password aging information for the specified user.
For example, to set the minimum number of days between password changes to 30 days for the user john
, you would run the following command:
This command will set the minimum number of days between password changes for the user john
to 30 days.
To set the number of days after a password expires before the account is locked to 7 days for the user john
, you would run the following command:
This command will set the number of days after a password expires before the account is locked for the user john
to 7 days.
To set the number of days of inactivity after which a password will expire to 14 days for the user john
, you would run the following command:
This command will set the number of days of inactivity after which a password will expire for the user john
to 14 days.
To set the date after which the account will expire to 2023-08-11 for the user john
, you would run the following command:
This command will set the date after which the account will expire for the user john
to 2023-08-11.
To list the password aging information for the user john
, you would run the following command:
This command will list the password aging information for the user john
, including the minimum number of days between password changes, the number of days after a password expires before the account is locked, the number of days of inactivity after which a password will expire, and the date after which the account will expire.
The chage
command is a powerful tool that can be used to change the password aging information for user accounts. It can be used to enforce password policies and to protect user accounts from unauthorized access.
Here are some additional things to note about the chage
command:
The
chage
command is part of the shadow package.The
chage
command can be used on any system that uses the Linux kernel.The
chage
command can be used to change the password aging information for any user account that is supported by the Linux kernel.The
chage
command is a safe tool to use. It will not damage any user accounts or systems.
help
Last updated