How to make rsync completely ignore permission from source

7,591

Use:

--chmod CHMOD

From the rsync man page:

To give new files the destination-default permissions (while leaving existing files unchanged), make sure that the --perms option is off and use --chmod=ugo=rwX (which ensures that all non-masked bits get enabled).

Share:
7,591

Related videos on Youtube

Samin yeasir
Author by

Samin yeasir

If you appreciate my questions/answers on SO and can afford to, please support me on GitHub Sponsors.

Updated on September 18, 2022

Comments

  • Samin yeasir
    Samin yeasir over 1 year

    I'm trying to use rsync to copy from an Android source where the sdcard mount has rather nonsensical permissions (---rwxr-x) and rsync fails because it creates the destination directories with the same permissions, then can't create any files in them. I want it to just ignore the permissions from the source and create all files/directories honoring the current umask. --no-perms does not work (and it's the default anyway; I'm not using -a) when new files/directories are being created; it simply prevents changing permissions on files/directories that already exist.