Frank Hamersley
2011-Apr-26 14:00 UTC
Connection to rsyncd over ssh tunnel seems to choke up (v2.6.9 Ubuntu)
I have been running the following (from a cron script with a non password authorized_key exchange) ... rsync -aP -vv --exclude=".*/" -e 'ssh -fN user at site.com.au -L 8873:127.0.0.1:873' rsync://localhost:8873/data/ /data/ ... and not getting much to happen as either evidenced in /var/log/rsyncd.log or as artefacts on the local file system. Then I started to execute the command(s) in a shell window and finally got some action by (1) leaving a previous ssh tunnel process (from a "failed" attempt) running and (2) then simply punching out the rsync command less the -e part?!? It seems (to my untrained eye) that there is a race condition between setting up the ssh tunnel and rsync client trying to tap rsyncd on tcp/873. Is this a credible possibility or alternatively have I missed something fundamental from the rsync command? Cheers, Frank.
Wayne Davison
2011-Apr-26 21:31 UTC
Connection to rsyncd over ssh tunnel seems to choke up (v2.6.9 Ubuntu)
On Tue, Apr 26, 2011 at 7:00 AM, Frank Hamersley <terabite at bigpond.com> wrote:> rsync -aP -vv --exclude=".*/" -e 'ssh -fN user at site.com.au -L > 8873:127.0.0.1:873' rsync://localhost:8873/data/ /data/The combination of daemon syntax and a remote shell tells rsync to connect to use the remote-shell command to run a single-use daemon, which it talks to over stdin/stdout. No ports are applicable in such a scenario, so no forwarding is needed. The -N option stops the command args from doing anything useful, so the local rsync isn't able to talk to the remote rsync on stdin/stdout (it just hangs waiting for some remote data). If you want to use a single-use daemon, put a rsyncd.conf file into the remote user's home directory and just combine -e ssh with rsync://user at site.com.au/data/. If you want to connect to an existing remote daemon service, you'll need to run the port-forwarding ssh command separately and kill it when rsync finishes (or leave it running, and add some start-it-up-if-it-isn't-running code). ..wayne..