Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I failed in ssh connection to a server. Here is the output of connection

$ ssh -v [server]
OpenSSH_5.1p1 Debian-3ubuntu1, OpenSSL 0.9.8g 19 Oct 2007
debug1: Reading configuration data /home/tim/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to [server] [server ip] port 22.
debug1: Connection established.
debug1: identity file /home/tim/.ssh/identity type -1
debug1: identity file /home/tim/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/tim/.ssh/id_dsa type -1
ssh_exchange_identification: Connection closed by remote host`

Anyone know what's wrong? Thanks and regards!

share|improve this question
up vote 2 down vote accepted

Check to see if the IP you are connecting from is showing up in hosts.deny on the remote server, and also check to see if you have lots of failed login attempts in /var/log/secure. If you do, delete those entries out of both files and you can sometime get back in.

share|improve this answer
Thanks! My IP is in hosts.deny on the remote server. So does it mean there is no way for my computer to access the server? BTW I don't have permission to see /var/log/secure. – Tim Oct 27 '09 at 1:54
if you can get the superuser on that computer to remove your IP from those 2 files, you should be good again. Unless it is SE linux which I know nothing about... :) – Zak Oct 27 '09 at 9:31

sh_exchange_identification: Connection closed by remote host even if the key is correct

Login via console or try login multiple times in ssh

Then check the permission of /var/log/btmp it must be 600 chmod 600 /var/log/btmp

share|improve this answer

Also, try logging in without using your private key. the only way i know to do this is to temporarily move aside your private key file.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.