I recently faced an issue when trying to connect through SSH to an account on a VPS. For this specific account, I traditionally use the standard username / password combination and everything used to work properly. However, last time I tried to connect, I faced the following issue:
$ ssh firstname.lastname@example.org ssh_exchange_identification: Connection closed by remote host
Using SSH verbose mode provided little additional information.
$ ssh email@example.com -v OpenSSH_5.9p1 Debian-5ubuntu1.1, OpenSSL 1.0.1 14 Mar 2012 debug1: Reading configuration data /home/jimmy/.ssh/config debug1: /home/jimmy/.ssh/config line 192: Applying options for * debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug1: Connecting to domain.com [126.96.36.199] port 22. debug1: Connection established. debug1: identity file /home/jimmy/.ssh/ids/domain.com/username/id_rsa type -1 debug1: identity file /home/jimmy/.ssh/ids/domain.com/username/id_rsa-cert type -1 debug1: identity file /home/jimmy/.ssh/ids/domain.com/id_rsa type -1 debug1: identity file /home/jimmy/.ssh/ids/domain.com/id_rsa-cert type -1 debug1: identity file /home/jimmy/.ssh/id_rsa type -1 debug1: identity file /home/jimmy/.ssh/id_rsa-cert type -1 ssh_exchange_identification: Connection closed by remote host
It seemed as if the connection was trying to use an SSH key to connect instead of the usual username / password.
There is however a simple solution. It requires access to WHM (so if you don’t, you might need to contact your web hosting company) and you’ll need to re-enable password authentication. To do so, simply follow the steps below:
- Log in as root
- Go to Security Center » SSH Password Authorization
- Click on the Disable Password Auth button (see screenshot below)
- Refresh the page and go back to the SSH Password Authorization page
- Click on the Enable Password Auth button
This fixed the problem and allowed to connect again using the traditional login / password authentication method.