How to preserve ownership with rsync over SSH

Bob Hutchinson hutchlists at midwales.com
Mon Aug 1 14:14:47 GMT 2005


On Monday 01 Aug 2005 14:56, Olivier BONHOMME wrote:
> Hello everybody,
>
> I am discovering rsync and I have a problem about preserving ownership
> and permissions. I want to mirror a web tree with rsync over ssh. I set
> up a module on my rsync server and on the rsync client, I use the
> options -o and -p in order to preserve ownership et permissions. The
> file are transffered via rsync but on the rsync server the files are
> owned by the user used to connect with ssh. I tried to find some docs
> but I found nothing and the man page is not clear for me : -- perms ==>
> root only what does that mean exactly ?

You need to be root at both ends. If you are using ssh you don't need to set 
up rsync modules. If you use ssh keys so that there is no login involved then 
it can be done automatically on a cronjob.

cd /my/backup/dir
rsync -a -v root at mydomain.com:/dir/to/be/backedup .

(note the dot on the end, and the single :)
use the -v first time so you can see it, once its all working get rid of it. 
You might also want to use -z for compression, and --exclude to *not* copy 
some files.

HTH
-- 
-----------------
Bob Hutchinson
Midwales dot com
-----------------


More information about the rsync mailing list