Sign up ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

In university I normally SSH into the CS server. However today I keep getting the following error: ssh_exchange_identification: Connection closed by remote host. SSHing with -v flags gives me the following.

OpenSSH_5.9p1, OpenSSL 0.9.8r 8 Feb 2011

debug1: Reading configuration data /etc/ssh_config

debug1: /etc/ssh_config line 20: Applying options for *

debug2: ssh_connect: needpriv 0

debug1: Connecting to ... [...] port 22.

debug1: Connection established.

debug3: Incorrect RSA1 identifier

debug3: Could not load "~/.ssh/id_rsa" as a RSA1 public key

debug1: identity file ~/.ssh/id_rsa type 1

debug1: identity file ~/.ssh/id_rsa-cert type -1

debug1: identity file ~/.ssh/id_dsa type -1

debug1: identity file ~/.ssh/id_dsa-cert type -1

ssh_exchange_identification: Connection closed by remote host

I've tried editing the hosts files but that won't help. Any suggestions?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

This can happen when you have too many different keys to offer. You can easily fix this by adding IdentityFile ~/.ssh/id_rsa_keyname to your ~/.ssh/config entry used for this connection and a global IdentitiesOnly yes. This can look like this:


Host foo
    User myUserName
    IdentityFile ~/.ssh/id_rsa_keyname

Host *
    IdentitiesOnly yes
share|improve this answer

I ran into this same exact issue. My system log reflected:

/var/empty must be owned by root and not group or world-writable

Going to Disk Utility > Macintosh HD > Repair Disk Permissions reset the permissions of /var/empty and solved the problem for me.

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.