I want to reach Ubuntu20.04 server U1
through Ubuntu20.04 server U2
since U1
is behind a firewall, from a MacBook with BugSur. SSH from U2 to U1 is done with a public key, without password. I get to U2
using password but the next step always asks for a password (which I can't remember now). I have seen this question and tried things like this in the MacBook's .ssh/config
:
Host U2
HostName accessible.uni.com
User me
# PreferredAuthentications publickey
ForwardX11 yes
Host U1
HostName behind_firewall.uni.com
User me
# PreferredAuthentications publickey
# IdentityFile /home/me/.ssh/id_rsa.pub
ProxyJump U2
ForwardX11 yes
and running ssh U1
enter the password for U2
but is then asked for password for U1
. How can I make it work password-free on the second ssh?
You can use Remote Command. Once it's successfully connected to U2 it will execute the command ssh U1.
Host U1
HostName accessible.uni.com
User me
# PreferredAuthentications publickey
ForwardX11 yes
RemoteCommand ssh U1