Ssh – How to solve this error: ssh_exchange_identification: Connection closed by remote host

sshssh-keys

data@server01:~$ ssh user@10.7.4.1 -vvv
OpenSSH_5.5p1 Debian-6, OpenSSL 0.9.8o 01 Jun 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 10.7.4.1 [10.7.4.1] port 22.
debug1: Connection established.
debug3: Not a RSA1 key file /home/data/.ssh/id_rsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /home/data/.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/data/.ssh/id_rsa-cert type -1
debug1: identity file /home/data/.ssh/id_dsa type -1
debug1: identity file /home/data/.ssh/id_dsa-cert type -1
ssh_exchange_identification: Connection closed by remote host

Best Answer

I suspect there's something wrong with your private key, probably the first line.

Don't paste it into the question.

How did you generate the private key? Can you try creating a new one? (Remember that they come in pairs so only do this if you can change the public key at the other end too.)