12

I've been trying to use rsync on OSX to Linux or Unix box over which I don't have much control. I've been doing something like this

rsync -avz -e ssh remoteuser@remotehost:/remote/dir /this/dir/ 

Error returned is:

bash: rsync: command not found rsync: connection unexpectedly closed (0 bytes received so far) [receiver] rsync error: remote command not found (code 127) at /SourceCache/rsync/rsync-37.3/rsync/io.c(452) [receiver=2.6.9]

However, after reading the docs I'm beginning to think that I would actually need to install an rsync daemon on the remote host.

  1. Must I install an rsync server on the remote host?
  2. Free alternatives -- GUI or non-GUI -- which do not require installing anything on the remote host?

Thanks!

3
  • 1
    What are the exact problems are you having with your current command?
    – fideli
    Feb 7, 2010 at 14:11
  • @fideli, sorry, forgot about that. Editing question now Feb 7, 2010 at 14:16
  • 1
    Thanks for this question, but can you tag it rsync please? Oct 17, 2010 at 3:54

4 Answers 4

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.

4
  • I like that solution a lot, particularly because the server is a cheap hosting plan on GoDaddy and I doubt I'll be able to run rsync on the server. +1 for now! Feb 7, 2010 at 15:11
  • What's the easiest route to go for install of sshfs on OSX? MacFuse or is there something easier? Feb 7, 2010 at 15:24
  • MacFuse + (MacFusion or sshfs-static-leopard), I think (I'm not an OSX user)
    – Tobu
    Feb 7, 2010 at 15:37
  • Yes MacFuse does it. Just that the download page for the sshfs binary gives you the binary with a .gz extension. So you have to rename it instead of gunzip'ing it. Annoying but okay now! Thanks Feb 7, 2010 at 16:32
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.

1
  • This was helpful, so +1, but I'm wondering how to specify the starting directory for rsync on the Windows side if I'm running it from Mac to PC like this: superuser.com/questions/1462861/…
    – Ryan
    Jul 23, 2019 at 0:28
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.

1
  • 3
    Not exactly, because rsync checks whether files are modified by size and timestamp, and that's still a lot more efficient than scp'ing all files. But indeed, the rsync incremental update mechanism within files doesn't make sense over sshfs. Jul 14, 2011 at 12:52
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 
2
  • 1
    Thanks Lee, SCP is great but it doesn't do "sync" right? Feb 7, 2010 at 15:07
  • 1
    it must be a small "r": scp -r
    – 0x4a6f4672
    Jan 23, 2013 at 10:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.