Today I was working on setting up public key authentication over SSH on few servers I inherited recently.Â I have done this many times and never ran in to following error:
ssh_exchange_identification: Connection closed by remote host
After doing further research on the server I was trying to connect to (looking at logs) I noticed the server was denying connection based on ip.Â I put my servers ip in /etc/hosts.allow and tried again.Â This time I was connected without any problems.Â Note that you do not have to restart SSH for hosts.allow change to take affect.
DISCLAIMER: Please be smart and use code found on internet carefully. Make backups often. And yeah.. last but not least.. I am not responsible for any damage caused by this posting. Use at your own risk.