Linux chage command

Linux chage command

 Linux chage command


he chage command is used to set an account expiration date for the user. It also changes the time the user’s password will expire.

Syntax:

$ chage [options] LOGIN

Examples:-

#1 – Set Password Expiry Days of User

Set the number of days to expire the password after the last change. It means the user will force to change its password after 15 days of the last change.

$ chage -M 15 testuser

#2 – Set Account Password Expiry Warning Date

You can also set the password expiry warning date. So that user gets an alert for the password expiration and to change the password.

$ chage -W 3 testuser

#3 – Set Account Expiry Date of User

You can also set the expiry date of any user in the Linux system. The account will automatically deactivate after passing the expiry date. Use the following command to set the expiration date of the account to Oct 28, 2019.

$ chage --expiredate "28 OCT 2019" testuser

#4 – List Account Aging Details

Run the following command to view the aging details of the user account.

$ chage -l testuser

#5 – Disable Password and Account Expiry

You can disable the password and account expiry any time using the following command.

$ chage -I -1 -m 0 -M 99999 -E -1 testuser

#6 – Force User to Change Password

You can also set the expiry date to 0 to force a user to change the account's password on the next login.

$ chage –d 0 testuser

Reactions

Post a Comment

0 Comments

close