The Computer Oracle

Rsync over ssh, or something else?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Horror Game Menu Looping

--

Chapters
00:00 Rsync Over Ssh, Or Something Else?
00:54 Accepted Answer Score 22
01:30 Answer 2 Score 6
02:30 Answer 3 Score 1
03:19 Answer 4 Score 0
03:45 Thank you

--

Full question
https://superuser.com/questions/105837/r...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#linux #macos #unix #rsync

#avk47



ACCEPTED ANSWER

Score 22


You need an rsync command on the server, but you don't need to run a daemon.

Get an rsync binary that works on the server, put it somewhere in your home, and add this flag to your command line: --rsync-path=/home/user/path/to/rsync .

If you don't want to copy rsync to the servers, you can use scp, or sshfs.

sshfs user@host ~/sync/user-host
rsync -av ~/local-dir ~/sync/user-host/remote-dir

In that case rsync will run completely locally, but the changes will be propagated to the server.




ANSWER 2

Score 6


You need to have rsync on the remote host -- not necessarily an rsync server (which, I believe, won't handle the ssl connection anyway), but rsync on the local box needs to talk to an rsync on the remote box. You're using ssh to link the two.

Assuming rsync does exist on the remote box, it is not in the default search path for your ssh logged in shell. Depending on your preferences and permissions on the remote box, you can try

  • using the --rsync-path= option
  • changing the default PATH for your remote ssh shell
  • adding an alias for rsync in the remote ssh shell
  • changing the executed remote command to the absolute path to rsync

or something similar. If rsync as an executable (vice server) does not exist on the remote host, it would have to be added.




ANSWER 3

Score 1


There is not much point using rsync without running an rsync daemon on the remote host, in spite of the creative sshfs solution proposed above. The whole idea of efficiency in rsync is to have the two instances compare their local copies of the dataset by calcuating checksums locally, comparing them over the network, and only transmitting the actual data for those parts of those files which actually differ.

If you use sshfs or any network mount, it's only hiding the fact that it has to copy the entire dataset across the network from the remote host in order to calculate the checksums locally, and then transmit the differences on top of that. It would be quicker and cheaper to delete everything locally and 'scp -r' the lot.




ANSWER 4

Score 0


Try SCP. As you've already got ssh access you don't need to install anything else on the remote host :)

To copy files from the remote host to the localhost use :

# scp -R remoteuser@remotehost:/remote/dir /this/dir/ 

Or copy files from the localhost to the remote host with :

# scp -R /this/dir remoteuser@remotehost:/remote/dir