I have an EC2 instance which i've got a couple of sites hosted on and it's previously been workin really nice.
Today I try to SSH into it and it just refusing connections on port 22 even though the security group has it open and the security group is set to the instance.
Anyone help me out as to why this could be the case?
I just get this line each time - ssh: connect to host 54.247.99.86 port 22: Connection refused
The following are common causes for this error: The host reached the instance but there was no service listening on the SSH port. A firewall blocked and was set to reject the package instead of dropping it.
Ensure that you are attempting to connect to the right port number for your server. Blocks due to firewall intervention – Some servers may be protected by firewalls at various points. If you are using a firewall, ensure that it isn't blocking access to your SSH port.
This error occurs if you created a password for your key file, but haven't manually entered the password. To resolve this error, enter the password or use ssh-agent to load the key automatically. There are a number of reasons why you might get an SSH error, like Resource temporarily unavailable.
If your instance is EBS based and not an Instance store then take an ami image first as a backup, then stop the instance, boot a new raw instance.
As your old instance is EBS based, detach the volume and attach it to new instance. Once attached mount it to some directory, change the permission /var/empty/sshd, also do cat /etc/fstab to know where was your / partition mounted. Now umount the volume from new instance attach to the old instance with the exact mount point which you had when in fstab like /dev/sda1 for /.
Once attached, start the old instance and check whether you are able to login or not.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With