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.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
-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.
date +%F -d "+30 days" which outputs the date in 30 days time from "today".
chage -E $(date +%F -d "+30 days") USER