Dear Lazy Web
If I write the following in my ~/.ssh/config:
Host bartunnel
HostKeyAlias bar
HostName bar
LocalForward 8822 foo:22
Host barjump
HostKeyAlias bar
HostName localhost
Port 8822
Then I can connect to host bar via host foo (circumnavigating a firewall that stops me from going to bar directly) just like am connecting to it directly. E.g. in two separate shells (in this order):
$ ssh bartunnel # this sets up the tunnel
# different shell (or use -n on the last one)
$ ssh barjump # now I'm connected normally
Now is there something I could write in my ssh configuration file that I could just do this in one step? I want to simply do:
$ ssh barjump
and the tunnel should be set up for me in the background. Likewise if I close the connection the tunnel should go. Is this possible?