2

After a recent upgrade of Ubuntu 12.04, ssh isn't working. Machine is a VM on Linode.

I am getting this error:

$ ssh root@IP-ADDRESS
ssh: connect to host IP-ADDRESS port 22: Connection refused

I have tried NMAP, and it's not showing port 22. At the moment, I have access to the vm, though Linode Lish, so I am able to run the server for now.. but need to fix ssh asap.

Any help or suggestion please?

4
  • Check the logs for errors. Be warned, debugging an upgrade takes longer then backing up your data and performing a fresh install . Also, post the output of ssh roo@IP-ADDRESS -vvv
    – Panther
    Sep 28 '15 at 22:37
  • connection refused is the output. as mentioned above.
    – soomro
    Sep 28 '15 at 22:46
  • Possible duplicat of askubuntu.com/questions/265982/unable-to-start-sshd
    – sмurf
    Sep 30 '15 at 1:39
  • @smurf you were right. resolved with: sudo apt-get purge openssh-server sudo apt-get install openssh-server tip: if you are using Linode, use LISH to execute this command, since "LISH is out of band and the direct console access to the Linode, which does not use SSH in any way."
    – soomro
    Oct 1 '15 at 14:15
0

Error "Connection refused" means that the host is up but there is no program listening to that port. The OS knows that and sends the appropriate error condition to whoever is trying to connect.

It seems that your ssh server is not starting for some reason. You will need to: - Start it in the foreground with command sshd -d -D and you will likely see the error printed on your console. - Look at the log files.

3
  • > sshd -d -D output: >sshd re-exec requires execution with an absolute path
    – soomro
    Sep 28 '15 at 22:50
  • should be sudo service sshd status rather then starting it directly.
    – Panther
    Sep 28 '15 at 23:24
  • strangely it says "sshd: unrecognized service" '# sudo service sshd status' 'sshd: unrecognized service'
    – soomro
    Sep 28 '15 at 23:57
0

I had the same problem after upgrading to 15.10. Was still able to connect from computer to itself, and from my phone to the computer, but not from Windows to the computer. Looked at the auth.log using System Log Viewer and found the message

sshd[9553]: error: Hm, kex protocol error: type 30 seq 1 [preauth]

Searched for that message and found this post which explains that it's an incompatibility between PuTTY and the latest OpenSSH. To fix it:

In PuTTY, go to “Connection → SSH → Kex”. There, select “Diffie-Hellman group exchange” and move it to the bottom of the list, so it is not used. The connection should start working as normal again.

Not the answer you're looking for? Browse other questions tagged or ask your own question.