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
For those of you who came across this post because you are unable to SSH into your EC2 instance after a reboot, this is cross-posted to a similar question at serverfault:
From the AWS Developer Forum post on this topic:
Try stopping the broken instance, detaching the EBS volume, and attaching it as a secondary volume to another instance. Once you've mounted the broken volume somewhere on the other instance, check the /etc/sshd_config file (near the bottom). I had a few RHEL instances where Yum scrogged the sshd_config inserting duplicate lines at the bottom that caused sshd to fail on startup because of syntax errors.
Once you've fixed it, just unmount the volume, detach, reattach to your other instance and fire it back up again.
Let's break this down, with links to the AWS documentation:
cd /etc/sshsudo nano sshd_configctrl-v a bunch of times to get to the bottom of the filectrl-k all the lines at the bottom mentioning "PermitRootLogin without-password" and "UseDNS no"ctrl-x and Y to save and exit the edited filecd /etcsudo nano rc.localctrl-x and Y to save and exit the edited file