At home I have a 2017 iMac running Big Sur and a couple of Raspberry Pi 4s on Buster. At my condo I have a 2010 MacBook and two more Pi 4s on Buster. The machines at the condo are behind a double NAT. Each one of them establishes a reverse SSH tunnel to the iMac so I can log into them from home. Normally, this works fine. When I'm at the condo I'm able to log into the iMac at home directly (no tunnel required). Normally, this works fine.
Sometimes it fails. For example, here I try to log in to the home iMac from the old MacBook at the condo:
Whitey:~ mnewman$ ssh -p 10000 [email protected]
ssh: connect to host xxxx.myddns.rocks port 10000: Operation timed out
I connect to the iMac via VNC, start a terminal session and restart the daemon:
sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
Then the remote ssh works fine:
Whitey:~ mnewman$ ssh -p 10000 [email protected]
Last login: Thu Dec 30 17:25:54 2021
MrMuscle:~ mnewman$
Same thing happens when logging in from the home iMac to the remote Pies. Restarting the daemon always gets things running again.
What can I do to avoid having to restart the ssh daemon?
sshd
on the Pi without a smoking gun. I lost my motivation for troubleshooting when the problem seemed to "go away" for a while, but it's come back & been consistent for quite some time now. And being honest, I don't feel I know this well enough to figure it out in any sort of a reasonable time frame. I'd love to see the OpenSSH team tackle this :) I wonder though - would they cast it aside as an "Off Topic" question?