This on a 2017 iMac running Big Sur (11.6) with OpenSSH_8.1p1, LibreSSL 2.7.3.

I sometimes have a need to log in to this machine remotely. I have forwarded the port appropriately.

But, sometimes I get a "connection refused" error. This can be remedied by the following:

sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist

If I'm away home, there's no way for me to run this. So, I'm trying to find out why reloading the daemon is necessary and if there's anything I can do to keep the daemon running.

  • Is there anything in the logs? Can you run sshd with extended logging and look out for any issues?
    – nohillside
    Oct 26, 2021 at 10:50
  • I'm not sure how I'd know where to look in the logs because I don't know when it failed. To do extended logging am I going to have to edit ssh.plist? I guess I can use -E and name a log file.
    – Buadhai
    Oct 26, 2021 at 11:17
  • This appears in the system.log with great frequency. Sometimes dozens of times per hour: Oct 27 04:28:21 MrMuscle com.apple.xpc.launchd[1] (com.openssh.sshd.65F16390-95A1-4A76-88A7-9FC0A977B91E[88955]): Service exited with abnormal code: 255
    – Buadhai
    Oct 26, 2021 at 21:50

1 Answer 1


I believe I figured this out. At home I have a dynamic IP address for which I use a dynamic DNS service. That dynamic IP changes several times per day. The machines to which I want to connect via ssh are behind a double NAT. To overcome the double NAT I set those machines up with an ssh tunnel back to my home machine. That tunnel depends on knowing the IP address of the home machine. When the home IP address changes, the tunnel fails. It can only re-establish itself when the dynamic DNS service is updated. Sometimes that is slow. That can make it appear that ssh is not working. Reloading the ssh daemon probably has nothing to do with it. It's all about having the patience to wait for the dynamic IP update.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .