How to tell rsync not to touch the destination directory permissions?

Posted by Sorin Sbarnea on Server Fault See other posts from Server Fault or by Sorin Sbarnea
Published on 2012-12-08T16:48:06Z Indexed on 2012/12/08 17:06 UTC
Read the original article Hit count: 161

Filed under:

I am using rsync to sync a directory from a machine to another but I encountered the following problem: the destination directory permissions are altered.

rsync -ahv defaults/ root@hostname:~/

The problem is that in this case the permissions and ownership of the defaults forlder will be assigned to the destination folder.

I do want to keep the permissions for the files and subdirectories but not for the source directory itself.

Also, I do not want to remove any existing files from the destination (but to update them if needed), but I think that current settings are already ok regarding this.

How can I do this?

© Server Fault or respective owner

Related posts about rsync