Was your EC2 SSH connection refused after reboot? You are in luck! The Support Team at Bobcares is well-versed in finding solutions for challenging issues like this one.
If you have been at the receiving end of Connection timed out or Connection refused error messages when attempting to connect to EC2 via SSH, our Support Engineers have a solution for you.
How to fix EC2 SSH connection refused after reboot?
The EC2 SSH connection error often arises due to issues with connecting to the instance. In other words, the request has failed to reach the instance and winds up timing out. This error may also occur if a firewall has blocked access or if SSH is not running on the instance.
Resolving: EC2 SSH instance after reboot connection error
- First, stop the broken instance.
- Then go to the EC2 Management Console and navigate to Elastic Block Store. After that, select Volumes and right-click on the volume related to the instance you stopped in the previous step.
- Next, start a new instance, Make sure it is in the same region and also of the same OS as the instance we stopped earlier. After that, attach the original EBS root volume to the new instance as a secondary volume.
- After you have mounted the broken volume on other instance, go to the /etc/sshd_config file and check for duplicate entries with these commands:
cd /etc/ssh sudo nano sshd_config
Then use ctrl-v a couple of times to go to the bottom of the file.
After that use ctrl-k on the lines at the bottom that mentions “UseDNS no” and “PermitRootLogin without-password”.
Following this save the edited file and exit. - The next step is to fix the reason behind the error by running the following commands:
cd /etc sudo nano rc.local
Then find the lines consisting of “PermitRootLogin without-password” and delete them. Then save the edited file and exit.
- After that, unmount the volume.
- Then go to the EC2 Management Console and navigate to Elastic Block Store. After that, select Volumes and right-click on the volume related to the instance you stopped in the previous step.
- Reattach it to the new instance and start it again.
[In search of help? Try our Server Management Services.]
Conclusion
In brief, we learned what to do when faced with a Connection timed out or Connection refused error message. Our Support Engineers demonstrated how to stop the error by getting to the root cause.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
0 Comments