0

How can I rsync files between two remote servers?

I need to transfer files between two remote hosts, but it seems rsync doesn't support synchronization.

Some more information: I have 2 servers A and B, and there is no direct connectivity between A and B. So direct rsync is not possible. But I have a 3rd server from when I have uni-directional connectivity.. Like I have the connectivity from C to A and C to B.

So can anybody help me here to rsync the file from server A to server B by using mediator as C?

Thanks in advance.

  • 1
    Would use ssh tunneling between A-C and C-B bridging them together (there are tons of examples around, its a one-line command). Then issue a normal rsync between A and B. – marc Mar 19 '18 at 16:37
  • There seem to be several links on this site that already deal with your question. Did you notice either of these? https://unix.stackexchange.com/questions/284079/how-to-rsync-files-between-two-remotes-with-an-explicit-port-and-different-usern https://unix.stackexchange.com/questions/183504/how-to-rsync-files-between-two-remotes – user1404316 Mar 19 '18 at 21:26

1 Answers1

0

Whilst its not the nicest way of doing it, here's an option:

Use SSHFS. Create two folders on your local system (serverC) (e.g. folder1, folder2).

sudo apt-get install sshfs

then run this:

sudo sshfs -o allow_other,defer_permissions user@serverA:/folder/ /mnt/folder1

and this:

sudo sshfs -o allow_other,defer_permissions user@serverB:/folder/ /mnt/folder2
AdminBee
  • 22,803