Saturday, January 31, 2015

SSH connections through proxies

SSH connections through proxies


Sometimes, it is very annoying to connect into a server that is bind a firewalls. You need to connect that is reachable outside first and then ssh into the server.

Here is a little tip I found;
http://sshmenu.sourceforge.net/articles/transparent-mulithop.html

The explanation in above page is extremely helpful, so you got to read it.
For the short summary for a head-first person like me,
you can set up a ssh config file, $HOME/.ssh/config, like the following example.

#### Example .ssh/config file #####
Host *
        ForwardX11 yes
        Compression yes
        ServerAliveInterval     120
        ServerAliveCountMax     3

Host proxyserver
        Hostname proxy.myworkplace.edu

Host myworkstation
        ProxyCommand ssh -q proxyserver p nc -q0 Hera 22


Without this setting, I ran "ssh proxyserver" first and then "ssh myworkstation" from the proxyserver.
But, this config file helps me to log into my workstation with single "ssh myworkstation" at home!!


No comments:

Post a Comment