Apple - ssh_exchange_identification: Connection closed

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.


Little snitch was the problem for me. Rules > Incoming connections

You must do this from the Little Snitch application's preferences.

little snitch allow incoming ssh


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:

~/.ssh/config

Host foo
    hostname server.example.com
    User myUserName
    IdentityFile ~/.ssh/id_rsa_keyname

Host *
    IdentitiesOnly yes

Tags:

Macos

Ssh