0

I have two virtual servers with Ubuntu 16.04 hosted by different providers. After I migrated my desktop from Win7 to Win10 I can not connect to the servers via SSH (see the error messages below). I have tried other operating systems as well:

  • Windows 10 and ChromeOS: connection refused
  • Windows 7, Android 8, Ubuntu 16.04 (on desktop): connection works

The same application (JuiceSSH) can connect on Android, but returns 'connection refused' on ChromeOS.

The error messages:

1. Gitbash (Windows 10)

$ ssh user@myhost
ssh: connect to host myhost port 22: Connection refused

2. Secure Shell (ChromeOS, with -vvv)

Connection with user@myhost is established...
Loading NaCl plug-in... Finished
OpenSSH_7.6p1, OpenSSL 1.0.2k 26 Jan 2017
debug2: resolving "myhost" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to myhost [myip] port 22.
debug1: connect to address myip port 22: Connection refused
ssh: connect to host myhost port 22: Connection refused
NaCl plug-in ended with the status code"255".

3. Bitwise SSH Client (Windows 10)

...
06:34:46.871 Connecting to SSH2 server slejska.de:22.
06:34:47.918 Connection failed. FlowSocketConnector: Failed to connect to target address. Windows error 10061: No connection could be established because the target computer refused the connection.
06:34:47.949 The SSH2 session has been terminated.

Remarks:

  • I regenerated OpenSSH host keys on the servers, but without any effect.
  • I deactivated the Windows Defender Firewall, but also without any effect.

Solution:

The port 22 was for some computers blocked on the router. It had nothing to do with the operating system. After opening the port for all computers, works everyting perfect. Thanks to @Nathan-McCoy

5
  • 1
    Can you run nmap to verify that port 22 is open on that server? Mar 18, 2018 at 11:17
  • 1
    Thanks Nathan. I installed nmap on the Win10 machine. I executed the command 'nmap -p 22 -T4 -A -v myhost'. It looks like, that the port is closed. But I do not understand, where it is closed. I suppose, it is closed on the desktop. Mar 18, 2018 at 12:02
  • 1
    I have open the port 22 with an inbound and an outbound rule for the Windows Firewall (tomshardware.co.uk/faq/id-3114787/…). But it has no effect. Mar 18, 2018 at 12:08
  • 1
    I have found it. The port was blocked on the router (but only for the new computers). Mar 18, 2018 at 12:18
  • great! glad it worked out. Mar 18, 2018 at 14:57

1 Answer 1

1

Just making my original comment more visible.

Not all systems allow TCP port 22 by default, which is the default port for ssh.

Here are some things to try and help find the source of the issue.

Suggestions

Check for open port on client

Run nmap <server> on the client which wants to connect via ssh.

If port 22 is not shown as open, this may be a firewall issue.

Check for open port on server

Run netstat on the server to see which ports are open.

If port 22 is not LISTENING then the ssh daemon is not setup properly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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