I used to connect to a remote server (e.g., [email protected]) through a bastion machine (e.g., [email protected]) using the following command from my local machine:
ssh [email protected] The above command does not require the password, as I have set up SSH keys for the connections (local --> bastion, bastion --> target), in addition to the following configuration in the ~/.ssh/config of my local machine:
Host target.example Match User userT ProxyCommand ssh -o 'ForwardAgent yes' [email protected] 'ssh-add && nc %h %p' Recently, the administrator of target.example has observed that I caused a lot (hundreds) of non-closed connections. I was then recommended to use ProxyJump instead:
Host target.example Match User userT ProxyJump [email protected] This command worked at first, but after a restart of my local machine, each connection requires me to enter the password for [email protected]. As a workaround, I do this each time I restart my machine:
- Change the
ProxyJumpline in~/.ssh/configto theProxyCommandline. ssh [email protected].- Change the
ProxyCommandline in~/.ssh/configback toProxyJump.
The above is highly inconvenient. Therefore, I would like to know if there is a way to make ProxyJump works correctly (i.e., allowing me to connect to target.example without typing any password. (Just in case: The version of OpenSSH on my bastion machine is 6.0, while ProxyJump requires >= 7.3, I am not sure if this is the root cause of the issue.)
Thank you very much in advance for your help!
Update:
I tried adding ForwardAgent to ~/.ssh/config as suggested by @Wieland:
Host gateway.example ForwardAgent yes Host target.example Match User userT ProxyJump [email protected] but the issue remains.
Host gateway.example\nForwardAgent yesto your SSH config file?target.exampleas well when usingProxyJump. Now everything is working.