Multiple ssh jump in iTerm2

266 Views Asked by At

I have few ssh host, like host_A, host_B and host_C. To connect to host_C, I have to ssh to host_A, then ssh to host_B (host_A and B are jump server), then finally ssh to host_C.

Does iterm2 support jump server setting? Or this can only be done using script? (Or, is there a recommended GUI ssh client?)

1

There are 1 best solutions below

1
cyberbrain On

If you use the "command" parameter of the profile for a connection, you can use the -J parameter of the ssh command to use a jump host. From sshs manual:

-J destination

Connect to the target host by first making an ssh connection to the jump host described by destination and then establishing a TCP forwarding to the ultimate destination from there. Multiple jump hops may be specified separated by comma characters. This is a shortcut to specify a ProxyJump configuration directive. Note that configuration directives supplied on the command-line generally apply to the destination host and not any specified jump hosts. Use ~/.ssh/config to specify configuration for jump hosts.

This means you can also specify multiple jumps in a row.

I would recommend that you first try the jumps and configuration on a plain login shell with a manually entered ssh command, and once you found the combination you are happy with, create an iTerm2 profile with that.