Votes: 0Posted On: Oct 15, 2017 03:39:54
You can get this error due to multiple reasons. The SSH connection might be refused either at the router, your firewall or there might be a problem with the SSH daemon. Here are some of the steps you can take to troubleshoot this problem. Here we are troubleshooting the problem on Ubuntu operating systems.
Check your SSH daemon
Check the status the SSH daemon installed on both machines.
service ssh status
service ssh start
If the status is active and running, then we move onto the other diagnosis. But if the SSH daemon is not installed on either of the machines, we have to reinstall the SSH daemon.
sudo apt-get remove
sudo apt-get install
Try and connect through SSH now. If the problem is resolved, you don't need to proceed further. If not, move on to next steps.
The SSH daemon might be blocked by your internal firewall(iptables in this case). Please check your iptables to check that the port 22 is not blocked.
If the port 22 is blocked, please run the following command to allow the SSH traffic.
ssh -j ACCEPT
Change the SSH port
Sometimes, the default port of SSH i.e Port 22 is blocked by the iptables or the ISP. Please change the port and restart the SSH service. You can do so by changing the SSH configuration file which is stored in "/etc/ssh/sshd_config". Edit the file using any editor of your choice. Here is sample shot of the file.
I am sure this will help in resolving your problem.