Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: ssh exchange identification: Connection closed by remote host  (Read 2961 times)

0 Members and 1 Guest are viewing this topic.

linsonj

  • Guest
ssh exchange identification: Connection closed by remote host
« on: November 03, 2013, 12:26:27 pm »

Issue :

=============================================
ssh exchange identification: Connection closed by remote host
=============================================

This error usually caused by deny rule mentioned in /etc/hosts.deny file. This file is being used by the tcpd (tcp wrapper) and sshd programs to decide not to accept a connection coming in from particular IP address.

If your IP address is listed there, it will lock you out of SSH.

In order to resolve the issue, Find your IP  /etc/hosts.deny file and clear the line. It'll look like:

sshd: [your ip]

Now lets save and exit out of your favourite editor and restart SSH

Now you'd think how you could remove the entry in the file /etc/hosts.deny if you're already locked out of SSH ?
Well, there is a way, please wait for my next post regarding this later ;)

If your server is managed by fail2ban or DenyHosts , there is a chance that the problem will often repeat itself. So lets do a final fix so it won't happen again.

Open the file /etc/hosts.allow

Scroll to the very bottom, and type this on a new line:

sshd: [your ip]

save the file. Then, restart SSH

Voila, problem solved!