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!