I'm lost with this, hopefully I can find some help here:
I have Ubuntu 12.04 LTS webserver.
For example I have user "myuser". There is a public directory which is my web root. I chowned it and all files in it as www-data:www-data. This enabled me proper work of PHP which can create/write files as PHP and web server run under www-data.
My problem is that when I transfer files with rsync through ssh my permissions, user and group for the files are changed. This mean after every transfer I have to do my chown again.
rsync -azv . -e ssh email@example.com/public/
I'm not sure if chown-ing the files is the "right" way, but I followed this tutorial at DigitalOcean: https://www.digitalocean.com/community/articles/how-to-install-wordpress-with-nginx-on-ubuntu-12-04 and they do the following:
sudo chown www-data:www-data * -R sudo usermod -a -G www-data username
As well as in other tutorials.
I need some way when I will be not need to chown/chmod or whatever my files after each transfer (same as it works on shared hostings)
Any ideas how to achieve that?