Question

ssh: connect to host 188.xxx port 22: Connection refused - root and sudo user

Hi,

After editing sshd_config to enable remote login - I wasn’t able to log into SSH again. the bad thing was, I exited SSH so I can’t log into SSH again.

here’s the error OpenSSH_6.9p1, LibreSSL 2.1.7 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 21: Applying options for * debug1: Connecting to [myIP] port 22. debug1: connect to address [myIP] port 22: Connection refused ssh: connect to host [myIP] port 22: Connection refused

Is there a solution to log in back to SSH? Should I log into console and then do anything?

Please help, thanks!

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Ok for those of you having problems like this - make sure the sshd_config file has no syntax errors. In my case, there was an additional(unwanted) space that I have to delete. Thanks!

If your root user has a password set you can log in via the console in the control panel. From there you should be able to edit sshd_config to revert your changes and restart the ssh service with

service ssh restart

Then you should be able to make an ssh connection again.