Apply permissions after executing rsync command

Asked

Viewed 665 times

0

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

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

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

chmod -R 775 *

After applying permissions the application works.

  • Why do I have to apply the permissions?
  • Why every time I run rsync command I have to apply permissions on the server?
  • At source the files already have the correct permissions?

1 answer

3


If the files are not with the correct permission in the source and you are using the "-a" parameter (includes preserving permissions) the files will arrive at the destination with the permission of the source. 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/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.