Firstly, you have to enable Core Helper:
Then edit your ~/.ssh/config
, put some lines to it:
Host localhost
IdentityFile ~/.ssh/id_rsa
Host jump1
IdentityFile ~/.ssh/key1.pem
Host jump2
IdentityFile ~/.ssh/key2.pem
Next, create a tunnel with host point to target
and login with user4
, in Connection tab set Proxy Jump option to:
user@localhost,user2@jump1,user3@jump2
The directives configured in ~/.ssh/config
would be applied to jump hosts accordingly. You can find more directives at here:
https://man.openbsd.org/ssh_config.5
Feel free to comment if you need assistance.