Local Computer (Fedora) --SSH--> Server1 --SSH--> Server2
In some environments I work in, we have to use "jump boxes" where you ssh to one server in order to get to another server. Is there a quick way to do this, perhaps by editing ~/.ssh/config, such that whenever I ssh to Server2 from my local computer, it automatically creates the necessary connection to Server1? I can setup keys so that I'm not prompted for a password to Server1 if necessary.
Best Answer
This type of functionality was added into OpenSSH version 5.4 and can be used by doing
Where
server2
is your intended destination andserver1
is your proxy host. You can make this easier by using theProxyCommand
option in your ssh config, something like:I've also seen it done using netcat, so with the same examples as above
Similarly, this can also be used in your ssh config, except replacing the
ProxyCommand
as