Last Updated: February 25, 2016
·
1.085K
· trott

SSH via an intermediary host

Let's say your shop is set up so you have to ssh to a machine (let's call it intermediary.example.com) and from there ssh to where you really want to go. (Don't ask me why, all I know is I run into this.)

If netcat (nc) is installed on the intermediary machine, you can use this in your ~/.ssh/config to make it so when you type ssh target, you go through the intermediary machine automatically. (There are other ways to do it without nc and I honestly can't remember why I stopped doing it that way and started doing it this way, but there was a reason. Educated guesses as to what the reason was are welcome. ANYWAY...)

Host target
  ProxyCommand ssh -q intermediary.example.com nc target.example.com 22

https://gist.github.com/Trott/7271573