What I couldn't figure out is how to sync local files to remote host, while leaving remote folder permissions for a particular folder /var/www/site1/home/images intact, which is 750, while source folder permissions are 770. I need this folder apache-writable locally, but it shouldn't be writable on production server. And I need to keep target permissons only for this folder, for all other files and folders perms must be updated.
Thus far I was experimenting with --exclude, -filter but didn't get the desired effect.
rsync -av --delete /var/www/site1/ [email protected]:/var/www/site1/
From the rsync man page: -a archive mode; same as -rlptgoD
.
-p
is preserve permissions, so this should do what you want: -vrltgoD