Currently I am backing up gigabytes and gigabytes of data from a live server to a backup server using an rsync/ssh combination script, allowing for automated operation every night with a cron job.

The problem I am having is with permissions.

Running rsync with -a mode copies over the user:group and filemode, which are currently 54122:games and -rwx--S---.

In order to be able to execute the files on the backup server (don't ask me why the employer requires this), I've had to run a time- and cpu-costly (because of the sheer amount of data transferred) chown() and chmod() setting every file/folder to www-data:www-data and permissions of 755.

Is there anyway I can setup rsync to forcibly set each file/folder to www-data:www-data and 755 or am I looking at this problem from the wrong angle?

I guess I could run -rltD instead of -a (which is equivalent to -rlptgoD) but then what happens to new files? What permissions and owner:group settings do they receive?

2 Answers 2


Amongst many other options rsync can change permission by running it with the option:

rsync [options] --chmod=CHMOD source destination

where you can also combine option --archive with the option --no-owner or --no-perms to exclude preservation of owner resp. permissions. For further options on very subtle settings for CHMOD see the manpage for rsync.

  • Note that the --perms flag is required to get the above command to work. Also, though I didn't try, I assume the --no-perms flag will not work, it will most likely disable the --chmod flag.
    – laurent
    Aug 19, 2016 at 21:04
  • 7
    Example: rsync --chmod=ugo=rX source/ destination/
    – Flimm
    Feb 3, 2017 at 14:57
  • Another example: rsync --chmod=764 source/ destination/
    – andschar
    Mar 3, 2020 at 12:29

If the permissions are already setup that way on the machine you are copying from you could try -p. It saves the permissions. Also you may want to try grsync. It's a gui for rsync that makes some of the options more apparent. Also -o preserves the owner.

Hope that helps. Good luck.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.