Redirect all SSH traffic through a “middleman” server

rsyncsshtunnel

this is my setup right now:
A. My NAS with static IP, reachable via SSH from the Internet (OS X)
B. a VPS (Ubuntu Server)
C. a dedicated server (Gentoo)

My question:
Due to bad peering i want to tunnel all my SSH traffic from A to C through B (rsync, flexget,… running on A)

I know how to rsync using a tunnel but i can't really figure out how to make it happen so it's pushing all the traffic through the tunnel.

thanks!

grimes

Best Answer

Another way is to use netcat as an ssh proxy command. Append this to the file ~/.ssh/config on Host sourcehost:

Host targethost
    ProxyCommand ssh -q viahost nc -q0 C 22

Then ssh targethost on Host sourcehost should tunnel via Host viahost. Rsync etc. should also work. Consider to use ControlMaster like this:

ControlMaster auto
ControlPath $HOME/.ssh/tmp/%h_%p_%r
Related Question