ssh_exchange_identification: Connection closed

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

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


I just had this issue, and resolved it by going to System Preferences on the Mac, open Sharing, and enable Remote Login.

In my case, I'd been able to access a reverse tunnel for years, but it stopped working after system settings were wiped in a hardware upgrade. This fixed it. Adding the IdentityFile did not.