Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (12.9k points)

I've set up the EC2 instance couple days ago and even last night I was able to SSH to it with no problems. Today morning, I can't ssh to it. Port 22 is already open in the security group and I haven't changed anything since last night.

Error:

ssh: connect to host [ip address] port 22: Connection refused

I had similar issue recently and i couldn't figure out why it was happening, so I had to create a new instance, set it up again, and connect and configure all EBS storages to the new one. Took me couple hours... and now it's happening again. In the previous one, I've installed denyhost, which might have blocked me, but in the current one, there are only apache2, and mysql running.

The current instance has been up for 16 hours now, so I don't think it's because it didn't finish booting... Also, port 22 is open to all sources (0.0.0.0/0) and is using tcp protocol.

Any ideas?

Thanks.

1 Answer

0 votes
by (18.2k points)

Seems to me that the sshd has stopped. One reason could be that the sshd was supposed to be started after the fstab is successful. But it wasn't and that's why it's now refusing the connection.

To resolve this issue you can just stop using fstab or create a temporary instance, mount EBS from the original instance and comment out stuff from fstab. Now you will be able to connect again.

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...