Suggestions for basic rsync configuration

Matt McCutchen matt at mattmccutchen.net
Fri Mar 14 16:59:02 GMT 2008


I'd like to expand on Stuart's response a bit...

On Fri, 2008-03-14 at 06:29 -0700, Geofoxer wrote:
> Thanks for your response, I think that I am on my way of getting stuff
> configured here. I still have a couple of questions though. I am also using
> linux with rsync!!! I want to clear up the usage of the following command:
> 
> rsync --progress -zav -e ssh /random/file-or-directory
> <remote-server-ip-address>:/random/file-or-directory

Like most copy commands, rsync interprets its last argument as the
destination and the previous argument(s) as source(s).  Thus, that
command pushes files from your machine to the remote server.

To decide whether you want to use a trailing slash on the source, see
the "USAGE" section of the rsync man page.

> And what happens
> when I switch it around like the following:
> 
> rsync --progress -zav -e ssh
> <remote-server-ip-address>:/random/file-or-directory
> /random/file-or-directory

That one pulls files from the remote server to your machine, which is
probably what you want in order to back up the remote server to a drive
on your machine.

> I have set up the rysnc daemon successfully on the remote server (I think),
> which prompts for the password when I connect. I get the following error
> when I run rsync daemon: 
> 
> # rsync daemon
> rsync: link_stat "/directory-path/daemon" failed: No such file or directory
> (2)
> rsync error: some files could not be transferred (code 23) at main.c(977)
> [sender=2.6.9]
> 
> Is there anything that I still have to configure for the rsync daemon? I
> also get the following error when I run the following command:
> 
> # rsync --progress -zav -e ssh /random/file-or-directory
> <remote-server-ip-address>:/random/file-or-directory
> Password: 
> building file list ... 
> 1 file to consider
> ERROR: cannot overwrite non-directory with a directory
> rsync error: errors selecting input/output files, dirs (code 3) at
> main.c(488) [receiver=2.6.8]
> rsync: connection unexpectedly closed (8 bytes received so far) [sender]
> rsync error: error in rsync protocol data stream (code 12) at io.c(453)
> [sender=2.6.9]
> 
> Is this an error from a lack of rights to the files and folders that I want
> to copy? I might have misconfigured my config, I can post it if you want.

OK, let's be clear here.  If you want to start a daemon to accept
connections, the command is "rsync --daemon"; pass a --config=FILE
option if you want to use a configuration file other than the
default /etc/rsyncd.conf .  If you want to access an rsync daemon, put a
*double* colon after the remote hostname:

<remote-server-ip-address>::/random/file-or-directory

In your second command above, you used a *single* colon, so rsync used
plain ssh, not a daemon.  The fact that the run got as far as "building
file list" is evidence that the ssh part is working.  You can continue
using ssh, or you can switch to using the daemon by putting a double
colon after the remote hostname (and removing "-e ssh" unless you want
to use the special daemon-over-remote-shell mode).

The "ERROR: cannot overwrite non-directory with a directory" means
exactly what it says.  If you are trying to copy a directory (or
multiple files, which rsync will put in a directory), the destination
path must not refer to an existing file that is not a directory.  Delete
or move away the offending destination file and try again.

Matt



More information about the rsync mailing list