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.

Solution 3:

that I am able to connect with the same command, keys, etc, from the same macbook and a different user

Maybe you need to RUN this with the new user (in your home directory):

ssh-keygen -t rsa

ssh-copy-id -i .ssh/id_rsa.pub gatekeeper@gateway 

ssh-copy-id -i .ssh/id_rsa.pub ubuntu@node