Last Updated: February 25, 2016
·
1.006K
· fritschy

Virtual SSH-Hosts

The entry of Host-stanzas in the ssh_config or ~/.ssh/config allows one to specify custom settings for specific hosts or groups of hosts. One thing that is remarkable however, is that it allows one to create virtual SSH-Hosts just by creating a custom Host entry with a name of ones chosing:

Host home
HostName home-router.ath.cx
Port 12345
LocalForward xyz

But may also involve nifty ProxyCommand things, e.g. through tor or some other already set-up tunnel:

Host tunnelled-home
ProxyCommand nc localhost 12345 # or socat, or torproxy or ...
RemoteForward ...

The specifics are documented at in ssh_config(5).

Of course this is also very useful with all things that use ssh as a transport, such as rsync or git.