Sshd: Service exited with abnormal code: 255

ssh

Every SSH connection exits with an abnormal code.

For example

ssh corti@myhost.example.com true

results in

Feb 11 10:16:47 mac-mini com.apple.xpc.launchd[1]: (com.openssh.sshd.163F2BE0-40C6-4B17-AB4E-5A0A07A524DE): Service instances do not support events yet.
Feb 11 10:16:48 mac-mini.home sshd[35674]: Accepted publickey for corti from ***.***.***.*** port 65030 ssh2
Feb 11 10:16:48 mac-mini.home sshd[35676]: Received disconnect from ***.***.***.***: 11: disconnected by user
Feb 11 10:16:48 mac-mini com.apple.xpc.launchd[1]: (com.openssh.sshd.163F2BE0-40C6-4B17-AB4E-5A0A07A524DE[35674]): Service exited with abnormal code: 255

Why is sshd exiting with a non zero return value (i.e., 225)?

Best Answer

In recent macOS versions, the rotten fruit geniuses have restricted SSH access to admin users only. I was having this 'service exited with abnormal code' issue and I fixed it by Preferences -> Sharing -> Remote Login: On and 'Allow Access to': All Users (or the users/groups you want). You must be an admin to do that (you must be able to unlock the locker icon on the bottom left).

Two hours wasted, damn idiots...