How to prevent deletion of files on the client side?

Métras Pierre p.metras at
Wed Jun 15 18:13:46 GMT 2005


> > I suspect that the passphrase file is not transmitted in the files 
> > list to the client, as it is excluded on the server. But 
> the --delete 
> > on the client side removes it. [...] To keep it on the 
> mirror, I have 
> > to exclude it again on the client side.
> See the rsyncd.conf manpage in the section on the "exclude" 
> config option for an explanation of why this is necessary:

The sentence I was missing is "Because this exclude list is not passed to the client it only applies on the daemon: that is, it excludes files received by a client when receiving from a daemon and files deleted on a daemon when sending to a daemon, but it doesn't exclude files from being deleted on a client when receiving from a daemon."

> > Is it possible to keep only one list of exclusion on the 
> server side 
> > or share it from both sides, and benefit from the --delete 
> option to 
> > remove files only in the directories transfered?
> You could just maintain the list on the receiving side only 
> -- if you only have one client pulling information, that is 
> the easiest place to maintain the list of exclusions.
> Another possibility is to install 2.6.5 on both hosts and 
> then switch over to using --delete-after and the -F option to 
> have rsync use per- directory filter files (each named 
> .rsync-filter) to limit the transfer and the deletions.  
> Either exclude everything in one file in the root of the 
> transfer, or sprinkle .rsync-filter files around in the dirs 
> where you want to exclude something (possibly anchoring the 
> exclude rules so that they apply only to the current 
> directory).  See the rsync manpage in the FILTER RULES 
> section for the rule format for the .rsync-filter files 
> (since filter rules aren't the same as includes/excludes, 
> though there is some similarity in the include and exclude rules):
> ..wayne..

All this is very powerful but complex to maintain and manage. The solution with the excludes file on the client side is not possible as I have many clients and for security I don't want to show some files from the server.

I've decided to go with a two steps process. As I have to create "mirror" servers, the exclude list for both servers are the same. So I rsync the exclude file first, and then rsync the actual directories tree using the same exclude file both on the server and on the client. That way, I can manage only the excludes list on the server and it is updated on all the clients.

Thanks for your help.

Pierre Métras

More information about the rsync mailing list