Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 04-30-2012, 01:11 AM   #1
Registered: May 2006
Location: BE
Distribution: Debian/Gentoo
Posts: 412

Rep: Reputation: 48
Post [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.

Last edited by eco; 04-30-2012 at 02:40 AM.
Old 04-30-2012, 02:34 AM   #2
Registered: May 2006
Location: BE
Distribution: Debian/Gentoo
Posts: 412

Original Poster
Rep: Reputation: 48
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.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
rsync via reverse ssh tunnel dexznrl Linux - Software 1 02-08-2011 08:38 AM
reverse rsync drkstr Slackware 2 10-09-2006 11:56 PM
Initiating Connection on XP host avatar_58 Linux - Networking 6 01-25-2005 09:30 AM
having trouble initiating HostAP wazilian Linux - Wireless Networking 0 09-03-2004 02:38 PM
Initiating SnowSurfAir Linux - Hardware 4 04-01-2003 05:41 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:43 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration