How to SSH to Ubuntu in Virtualbox (Part 2/2 – Troubleshooting ๐Ÿน)

1. Overview

In a previous article we described how to set up a ssh connection to a virtual machine with Ubuntu and a Windows host system.

This time we want to troubleshoot common errors occurring when trying to set up this configuration.

2. Errors

We are using a BiteVise SSH client and try to connect to our virtual machine. In the following several errors are described and possible causes are presented.

2.1 FlowSocketReader

11:18:59.819 Started a new SSH2 session.
11:18:59.825 Connecting to SSH2 server 127.0.0.1:2222.
11:18:59.825 Connection established.
11:18:59.826 The SSH2 session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. 
	Windows error 10054: Connection closed by remote host

We see that first a connection was established but then closed by the remote host – in our case the virtual machine. No bytes were received. So the routing seems to work but the tcp request were denied.

Possible causes:

  • SSH server not running on virtual machine -> check with netstat

2.2 FlowSocketConnector

 11:34:25.772 Started a new SSH2 session.
11:34:25.772 Connecting to SSH2 server 127.0.0.1:22.
11:34:26.774 Connection failed. FlowSocketConnector: Failed to connect to target address. Windows error 10061: No connection could be established since remote host rejected connection
11:34:26.787 The SSH2 session has been terminated.

Here no connection could be established. There might be several reasons

Possible causes:

  • Wrong host ssh port (2222 in our case)
  • VirtualBox port-forwarding misconfigured: wrong host machine’s port (in our case, should be 2222)

A similar error might arise:

11:39:12.461 Started a new SSH2 session.
11:39:12.470 Connecting to SSH2 server 127.0.0.1:2222.
11:39:12.470 Connection established.
11:39:12.470 The SSH2 session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10053: An existing connection was terminated by the host computer software

Possible causes:

  • VirtualBox port-forwarding malconfigured: wrong virtual machine’s port (should be 22)

2.3 Authentication Problems

 11:47:39.326 Started a new SSH2 session.
11:47:39.335 Connecting to SSH2 server 127.0.0.1:2222.
11:47:39.335 Connection established.
11:47:39.357 Server version: SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
11:47:39.357 First key exchange started. Cryptographic provider: Windows CNG (x86) with additions
11:47:39.370 Host key algorithm list after reordering: RSA/sha2-512,RSA/sha2-256,RSA,Ed25519,ECDSA/secp256k1,ECDSA/nistp521,ECDSA/nistp384,ECDSA/nistp256.
11:47:39.401 Received host key from the server. Algorithm: RSA, size: 2048 bits, MD5 fingerprint: xx, Bubble-Babble: xxx, SHA-256 fingerprint: xxx.
11:47:39.433 First key exchange completed using diffie-hellman-group14-sha1. Session encryption and integrity: aes256-gcm, compression: none.
11:47:39.446 Attempting password authentication.
11:47:41.203 Authentication failed. Remaining authentication methods: 'publickey,password'.
11:47:42.880 Attempting password authentication.
11:47:42.890 Authentication failed. Remaining authentication methods: 'publickey,password'.
11:47:44.567 Authentication aborted on user's request.
11:47:44.579 The SSH2 session has been terminated.

The ssh server is responding and offers several cypher methods. But the authentication fails.

Possible causes:

  • Wrong username / password
  • Wrong authentication method (defined by ssh server!)
  • No public key provided (if set up)

2.4 Firewalls

11:42:56.742 Started a new SSH2 session.
11:42:56.757 Connecting to SSH2 server 127.0.0.1:2222.
11:42:56.757 Connection failed. FlowSocketConnector: Failed to connect to target address. Windows error 10013: Socket acces not allowed due to socket permissions
11:42:56.757 The SSH2 session has been terminated.

No socket could be accessed by our host system / software.

Possible causes:

  • Host machines firewall
  • Router firewall

3. Conclusion

The presented errors are common but there are many more of course. It is important to first see if any connection was established and see if the ssh server is responding. After that there is authentication left. Step by step we can debug our ssh connection process in that way until we can connect successfully.

Leave a Reply

Your email address will not be published. Required fields are marked *