1

I am trying to ssh into my ubuntu server (which I have done many times before) and I get the error:

ssh_exchange_identification: Connection closed by remote host

ssh -vvv shows the following:

jimsmith:etc jimsmith$ ssh -vvv galleryserver
OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /Users/jimsmith/.ssh/config
debug1: Applying options for galleryserver
debug1: Reading configuration data /etc/ssh_config
debug2: ssh_connect: needpriv 0
debug1: Connecting to xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx] port 22.
debug1: Connection established.
debug3: Not a RSA1 key file /Users/richardelliot/.ssh/galleryserverkey.pem.
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
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /Users/richardelliot/.ssh/galleryserverkey.pem type -1
debug1: identity file /Users/richardelliot/.ssh/galleryserverkey.pem-cert type -1
ssh_exchange_identification: Connection closed by remote host

Can anybody help?

--UPDATE---

I just found out that the server has been upgraded. So basically its a new machine but it using the same key and ip-address

Bob Flemming
  • 1,375

2 Answers2

2

It seems like you are not using a proper SSH private key as is alluded to by

debug3: Not a RSA1 key file /Users/richardelliot/.ssh/galleryserverkey.pem.

SSH keys usually are usually not .pem files - that is usually reserved for x509 certificates. Check your ssh keys in ~/.ssh; usually you have something like "id_dsa" (private key) and "id_dsa.pub" (public key). If using RSA then these files are id_rsa and id_rsa.pub instead. Make sure your SSH configuration, ~/.ssh/config, for that host points to the proper SSH keys.

If these files are not present you can generated them with

ssh-keygen -t dsa

then give your private key a passphrase and use something like keychain to manage your keys. You would then copy the local workstation public key, ~/.ssh/id_dsa.pub and merge it into ~/.ssh/authorized_keys on the remote server - creating that file if required. Ensure the permissions and server configurations is correct.

1

Ok I figured out what the problem was.

A module called deny hosts was preventing my IP from connecting.

I managed to connect from another IP address and then I added my IP address to the /etc/hosts.allow file.

Bob Flemming
  • 1,375