I used to connect to a remote server (e.g.,
userT@target.example) through a bastion machine (e.g.,
userG@gateway.example) using the following command from my local machine:
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' userG@gateway.example '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 userG@gateway.example
This command worked at first, but after a restart of my local machine, each connection requires me to enter the password for
userT@target.example. As a workaround, I do this each time I restart my machine:
- Change the
- Change the
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!
I tried adding
~/.ssh/config as suggested by @Wieland:
Host gateway.example ForwardAgent yes Host target.example Match User userT ProxyJump userG@gateway.example
but the issue remains.