SSH and rsync through a socks proxy

I’ve been using Dropbox for quite some time to transfer files from work to my home PCs. This is worked well for months, but I finally filled my dropbox account.

watch life less ordinary a online As I have a linux box at work and a linux box at home I decided to try and setup some simply one way mirroring system.  I.e. mirror documents from work to my home PC.

I looked at using unison, which I used to mirror many other directories but I couldnt get it to connect out from my work PC.   It appears to lack socks support.  I know I could use ssh port forwarding to sync via sockets but this would be more complicated.

I decided to use rsync via ssh.

There was one main issue though, I needed to get ssh to work over our proxies.  We have a few http proxies and 1 socks proxy.  The http proxies will not connect to arbitrary ports so I ended up using the socks server.

I knew the socks server worked as I’ve used it with putty watch hannah montana the movie online for years, so I just needed to figure out how to setup ssh to use it.

After lots of search and finding articles regarding port forwarding and nothing about using a socks proxy I found 1 good article.

I use gentoo linux so I emerged net-misc/connect which supports socks servers.

emerge -auv net-misc/connect

Once I had the connect utility installed I needed to edit my ssh config file.  I only have 1 user configured on my linux box at work so I edited the ~/.ssh/config file.

This is what I added

ProxyCommand connect -S user@socks-server:1080 %h %p

ProxyCommand connect -S user@socks-server:1080 %h %p

ProxyCommand connect -S user@socks-server:1080 %h %p

You can also do the same thing with cygwin too.  Instead of using connect program its called connect-proxy in the network section of the cygwin installer.

After I got this far I needed to configure rsync to work via this ssh connection which, it turns out, is very simple.

rsync --progress -avrz -e ssh src_dir/

This results in the src_dir existing inside the dest_dir.

5 Responses to “SSH and rsync through a socks proxy”

  1. Unblock Me Says:

    Just wanted to thank you for a really good post. I found it quite useful and will check your site often.

  2. Toralf Förster Says:

    helped me too – thx

  3. Jerrod Luehrs Says:

    Cool article, I’ve been interested in internet security mechanisms for a few years now.

  4. firedfox Says:

    Thank you very much! It still helped me a lot after you posted it so many years

  5. Проброс трафика через транзитный сервер - linux debian ssh Says:

    […] […]

Leave a Reply