SSH Connection Closed Right After Login – Ubuntu 18.04 Server Fix

18.04serverssh

My server is running Ubuntu 18.04 and I'm having issues with SSH. Every time I log in, the connection is closed immediately after entering the password.

Connection closed by 193.xxx.xxx.xxx port 22

These are my logfiles: https://pastebin.com/2G4V52Vt (first part is the client-log, the second part contains the server logs in debug-mode)

I see that publickey authentication fails, but I guess that doesn't matter since I'm using a password instead.

The issue seems to affect all users and it doesn't matter which shell the user is using. (I tried /bin/bash, /bin/sh and /bin/rbash).

Can someone please help me with this? Please let me know, if you need more information.

Best Answer

In the provided log output we can see that the client and server are using different OpenSSL versions:

  • client: SSH-2.0-OpenSSH_7.8
  • server: SSH-2.0-OpenSSH_6.7p2

Which in this case was the reason that the connection got closed. OP removed SSH server and installed the correct version which resolved his issue.

Related Question