Rsync via two ssh tunnels possible (standard method mentioned
k times not possible?)
roman.fiedler at telbiomed.at
Mon Dec 15 09:54:31 GMT 2008
Matt McCutchen wrote:
> On Fri, 2008-12-12 at 12:56 +0100, Roman Fiedler wrote:
>> The goal is to sync two directories using rsync without running the
>> rsync daemon on one of the two hosts...
> I suggest you just replace your "nc" command with an rsync daemon
> listening on port 6666 on the SRC machine. This isn't any less secure
> than what you're trying now.
In the end I hope to run the two rsyncs just using the stdin/out of the
two ssh connections and the relay connection is done on the local host,
the nc thing is just for testing because it's easier to strace.
> If you really don't want an rsync daemon anywhere in the picture (though
> I'm not clear on why),
I hoped that I do not have to create a .conf file for the daemon (or
fiddle around with the cmd parameters) and that I do not need to care
about the auth settings for the daemon. Apart from that my rsync via
cmdline would run only once and terminate immediately after sync and
closing the ssh connection would stop the server thread if not
> you could use a single-colon source argument with
> "-e 'nc localhost 4444 #'" to have the client connect to the forwarded
> port and expect a bare server.
I tried that, but rsync tried to execute
[pid 8953] execve("/bin/nc", ["nc", "localhost", "1235", "#",
"localhost", "rsync", "--server", "--sender", ".", "src"], [/* 23 vars
*/]) = 0
The additional args caused nc to fail. Also \x00 instead of # did not
work. But following worked:
* Server side:
nc -vnlp 1235 -c 'rsync --server --sender -r . src'
* Client side
rsync -e './direct.sh' localhost:src dst
nc -v localhost 1235
The direct.sh just ignores any additional arguments.
But then it's your responsibility to
> make sure the server arguments on SRC are correct; rsync may crash if
> they aren't.
Yes, seems that that's exactly what happens, e.g with
nc -v -c 'rsync -v --server -a src .' localhost 7777
nc -vnlp 7777 -c 'rsync -v --server --sender -r . src'
[pid 8958] write(1, ".\0\0\10ERROR: buffer overflow in recv_rules
[sender]\n", 50) = 50
[pid 8958] write(1, "Z\0\0\10rsync error: error allocating core memory
buffers (code 22) at util.c(121) [sender=2.6.9]\n", 94) = 94
More information about the rsync