4

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!

3 Answers 3

2

Check to see if the IP you are connecting from is showing up in /etc/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.

2
  • 1
    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, 2009 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, 2009 at 9:31
2

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

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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