-   Linux - Software (
-   -   [SOLVED] initiating a reverse rsync (

eco 04-30-2012 02:11 AM

[SOLVED] initiating a reverse rsync
Hi all,

What I am trying to do is have server "A" ask server "B" to send files to server "A". So Server "A" should initiate an rsync request to have files from server "B" sent to itself.

The reason for this is that a few servers use rsync to backup their files to server "B" along with proper permissions, etc. To avoid connecting from server "A" to the server "B" as root , I need to ask server "B" to rsync the files to server "A".

I think this can be done with rsync-path but if it can... I haven't figured out how. ;)

Any advice help... or clarifications requests are welcome. :)

eco 04-30-2012 03:34 AM

It's good to have your own Guru at work ;)

The following is the solution for anyone wanting to do this. No credits to me, all to the anonymous Guru!

Add your key to avoid being prompted by a password

serverA $ ssh-add
Find out what socket you are using

serverA $ echo $SSH_AUTH_SOCK

Become root and define your user socket as the one for root

serverA $ sudo su -
serverA # export SSH_AUTH_SOCK="/tmp/ssh-XHGFQ10086/agent.10086"

Now when you ssh from root as your user, you can do so without password

serverA # ssh mysuer@serverB
Last login: Thu Apr 26 14:29:53 2012 from
serverB:~ $ logout
Connection to serverB closed.

Now, using our socket again, we initiate an rsync as root using the rsync-path to tell serverB it will also be running rsync as root although we connect as our user.

serverA # rsync -avn --rsync-path="sudo rsync" mysuer@serverB:/root/ /tmp/
receiving incremental file list
sent 139 bytes  received 1062 bytes  2402.00 bytes/sec
total size is 69933054  speedup is 58229.02 (DRY RUN)

Voila! We managed to tell rsync to sync the /root folder from serverB to serverA without having to ssh as root. Cooool.

All times are GMT -5. The time now is 07:18 PM.