M BUZZ CRAZE NEWS
// general

Date format of chage -E command

By John Parsons

I would like to know what is the right format to put in the command:

sudo chage -E (DATE) (USERNAME)

Also, if it is possible to put hours, minutes and seconds.

1 Answer

From man chage:

 -E, --expiredate EXPIRE_DATE 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.

Either you want a number of days, or a YYYY-MM-DD string. Time of day is not taken into account.

Try also date +%F -d "+30 days" which outputs the date in 30 days time from "today".

 chage -E $(date +%F -d "+30 days") USER

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy