Continuing with my latest adventures in AWS and Redhat, I found an issue that occurs with a pretty high degree of frequency. The problem occured when I did the following:
- Launch an image using the default RHEL image
- Configure/install all of the things needed for that instance
- Stop instance, create image from it.
- Launch instance from newly created image
- Try to connect to instance via SSH
- Connection refused. Sad face.
Turns out it’s an issue that is present in the image provided by Amazon, and the /etc/ssh/sshd_config is messed durring the image creation/rebooting process.
To fix this, I commented out the following three lines from /etc/rc.d/rc.local file:
1 cat <<EOF>> /etc/ssh/sshd_config 2 UseDNS no 3 PermitRootLogin without-password
And the following from /etc/ssh/sshd_config
1 permitrootlogin without-password 2 permitrootlogin without-passwordUseDNS no