I have an Ubuntu server in AWS EC2, and created a service to shut down automatically after three hours, in case I forgot to. I added a shutdown -h 180 command to a service that is started on boot. Since I didn't want to wait three hours I decided to test this by changing the 180 minutes to 3 minutes, and it worked great! Three minutes in, the server shutdown and my EC2 instance was stopped.

Unfortunately, now I'm unable to SSH into the server anymore. Now that it schedules this shutdown for three minutes after startup when I try to SSH it gives me the message System is going down. Connection closed... which I assume is because the shutdown is imminent.

Is there any way to fix this mistake when I can't login anymore?

1 Answer 1


You should be able to login fairly early in the boot cycle. You will need to be quick in fixing the timeout.

  • It takes about 5 seconds for the EC2 instance to start running, and I try SSHing immediately, but still get this message. I tried it about 20 times, but no luck logging in at all. Jan 5, 2021 at 18:08
  • 60th times the charm. I eventually was able to log in in the split second window right at startup. Thanks! Jan 5, 2021 at 18:15

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.