Mac SSH Issue: Connection reset by peer

After some recent updates to macOS High Sierra, I started having issues with being able to SSH into my work machine (Mac Pro) from my laptop (MacBook Pro w. Touchbar).  My laptop would get the following error:

"ssh_exchange_identification: read: Connection reset by peer"

Upon using the ssh -v (verbose) switch I didn't really see much of anything on the client.  So, looking in the /var/log/system.log I found another error message that helped spur me on to a resolution:

"com.apple.launchd[1] (com.openssh.sshd.****long alpha numeric string*****):Service exited with abnormal code: 255

This led me through several discussion boards before I found one (not related to SSH mind you) that mentioned having to change owner on the /var/empty directory:

sudo chown root /var/empty

Upon changing ownership, ssh now works again.  Not sure if an update changed ownership or what went on there, but my personal account was set as the owner prior to changing it to root.  Also, running Apple's "First Aid" option in DiskUtility did not repair the permissions on this directory.

Comments

Anonymous said…
Just wanted to say "Thank you!". You just saved me a bunch of time. Not sure how /var/empty ownership got changed.
Frederik said…
I second that! We ran into this problem after changing the host name of the Mac server and linking it to Active Directory ... Sometimes the internet is a genious place.

Popular Posts