I recently discovered that with ~/.ssh/config
, I can save a lot of keystrokes and automate long command lines, specifying a lot of per-host defaults. Now that I noticed how powerful the tool can be, I am wondering if it can fit another of my use cases.
I have access to two hosts, bastion
and wikispy
. Bastion has an external IP, wikispy
is only visible from the internal one. This means that normally in order to connect to wikispy
, I need to ssh to bastion
first and then call ssh wikispy
. Obviously things like port forwarding are going to be complicated this way and this is something I would like to avoid.
This leads to a question: can I somehow make ~/.ssh/config
entry that would tell "when the user requests host labeled wikispy
, actually connect to bastion
, then call ssh wikispy
"? Would it be possible to work transparently so that I could call things like ssh wikispy -L 9999:localhost:9999
and have bastion
forward the port in a way that would let me access it from inside of wikispy
?
inf
from#[email protected]
pointed me there: sshmenu.sourceforge.net/articles/transparent-mulithop.html