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.


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

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.