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!

David Pashley
  • 23,151
  • 2
  • 41
  • 71
Tim
  • 1,467
  • 3
  • 25
  • 38

3 Answers3

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

Mikelangelo
  • 121
  • 2
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.

Geoffrey
  • 165
  • 1
  • 2
  • 10
Zak
  • 1,032
  • 2
  • 15
  • 25
  • 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 '09 at 01: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 09:31
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.

Zak
  • 1,032
  • 2
  • 15
  • 25