Apply permissions after running the rsync command

0

I am synchronizing the files on my local machine with the server as follows:

  

rsync -avz -e 'ssh' --exclude = temporary ~ / Projects / test / * [email protected]: / var / www /

But for the application to work, I have to go to the server and inside the / var / www folder I have to modify the permissions:

  

chmod -R 775 *

After applying the permissions the application works.

  • Why do I have to apply the permissions?
  • Why do I have to apply the permissions on the server every time I run the rsync command?
asked by anonymous 18.06.2015 / 14:24

1 answer

3

If the files do not have the correct permission at the source and you are using the "-a" parameter (includes preserving permissions), the files will arrive at the destination with the source permission. To fix this add "- chmod" to your command line. Example:

rsync -avz -e 'ssh' --chmod=ug=rwx --chmod=o=rx --exclude=temporarios \
~/Projects/teste/* [email protected]:/var/www/
    
18.06.2015 / 14:58