Skip to content
Advertisement

Linux – User expiration date in hours [closed]

I am setting the expiration date of my linux users account using the command below:

chage -E '2017-04-07' username

However I can only block the user using dates, and when the day occurs the user is already blocked.

Would you like to have the account expire in 24hrs?

Tks!

Advertisement

Answer

You cannot use the ‘chage’ since it require specifying a date. If you want to inactivate a user after few minutes, use following

adduser username_here && sleep 600 && usermod --lock username_here

OR

adduser username_here
echo usermod --lock username_here | at now + 10 minutes
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement