To change the account expiration date for a user in Linux, you can use the chage command. Here’s how to do it:
-
Open a terminal.
-
Run the following command, replacing
usernamewith the actual username andYYYY-MM-DDwith the new expiration date you want to set:sudo chage -E YYYY-MM-DD username
For example, to set the account expiration date to December 31, 2025, you would use:
sudo chage -E 2025-12-31 username
-
To verify that the expiration date has been updated, you can check the account details with:
sudo chage -l username
This will display the updated expiration date along with other account information. If you want to remove the expiration date and allow the account to never expire, you can set it to never expire with:
sudo chage -E -1 username
This will remove any expiration date for the specified user account.
