5

MacPorts relies on rsync to do its job, and I rely on a SOCKS5 proxy to get full access to internet. How do I make rsync run all its queries through my proxy?

neu242
  • 714
  • 2
  • 7
  • 15

2 Answers2

1

Sorry to just paste a url, but its explained here. Essentially you install the connect utility, add something like this to ~/.ssh/config:

Host stokebloke.com
    ProxyCommand connect -S user@socks-server:1080 %h %p

Then use:

rsync --progress -avrz -e ssh src_dir/ user@homebox.homelinux.net:~/dest_dir/
Sirex
  • 5,447
  • 2
  • 32
  • 54
  • 1
    Yup, I've seen that one, but this would require that I add all hosts that rsync wants to use to .ssh/config. Also, how do I instruct MacPorts to use custom rsync arguments? – neu242 Jan 28 '11 at 07:38
  • 1
    You can set `rsync_server` and `rsync_options` in `/opt/local/etc/macports/macports.conf`. As an alternative method, use HTTP with the [daily tarball](https://trac.macports.org/wiki/howto/PortTreeTarball) or the [Subversion repository](https://trac.macports.org/wiki/howto/SyncingWithSVN). – raimue Feb 01 '11 at 01:13
  • I tried to add -e ssh to rsync_options, but it didn't help. Would I want to use something other that rsync.macports.org as rsync_server? (I'll try the http/svn options, though.) – neu242 Feb 09 '11 at 07:54
1

Alternatively to Sirex' answer, you can use nc(1) (netcat) to use the proxy.

Again, modify your ~/.ssh/config file:

Host server-prox
        Hostname www.server.com
        ProxyCommand /usr/bin/nc -x localhost:8080 %h %p

then run

rsync -e ssh server-prox:path/to/files

and rsync (or rather ssh) will automatically use the proxy command.

This assumes there is a SOCKS proxy running on localhost port 8080, which you can get with

ssh -D 8080 proxyserver.com

Personally I use

ssh -qfxND 8080 proxyserver.com

to set up a proxy tunnel, where -qfxN make the command run quietly in the background, see ssh(1).

Tim
  • 111
  • 3
  • But what is the server? If that is "any server in general" than I would be required to add that for all the servers port wants to use to get data from. That's quite a lot, i.e., it's not a feasable solution. – erikbstack Jan 15 '16 at 19:43