In this article, we will see wow to set Linux account expiry to specific date. We can set the account expiry date by using command chage with -E, –expiredate option.
-E, –expiredate option
Set the date or number of days since January 1, 1970 on which the user’s account will no longer be accessible. The date may also be expressed in the format YYYY-MM-DD (or the format more commonly used in your area). A user whose account is locked must contact the system administrator before being able to use the system again.
Passing the number -1 as the EXPIRE_DATE will remove an account expiration date.
Syntax to set Linux account expiry to specific date:
chage -E $(date -d +180days +%Y-%m-%d) username
or
chage -E date_in_format_YYYY-MM-DD username
Continue reading How to set Linux account expiry to specific date