SSH through intermediate host fails only on myuser@mymac but works elsewhere

Solution 1:

Finally I have been able to corner and identify the source of the problem. I could make the problem disappear by not sourcing the iterm2 shell integration, or just updating it to the latest version. This may be somehow related to using the fish shell.

I did not dig further into the problem, if anyone's interested please let me know.

Solution 2:

error: connect_to <node-ip> port 22: failed.

This looks like the port forwarding is disabled or limited by PermitOpen option in sshd config. Make sure it is allowed, if not, please post the sshd_config from gateway.