Skip to main content

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.

/home/myuser/public/

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 protected]/public/

I'm not sure if chown-ing the files is the "right" way, but I followed this tutorial at DigitalOcean: https://www.digitaloceanHow To Install Wordpress with nginx on Ubuntu 12.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?

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.

/home/myuser/public/

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 protected]/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?

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.

/home/myuser/public/

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 protected]/public/

I'm not sure if chown-ing the files is the "right" way, but I followed this tutorial at DigitalOcean: 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?

edited tags
Link
janos
  • 11.7k
  • 3
  • 37
  • 54
Source Link
depi
  • 151
  • 1
  • 3

How to properly setup web server directory permissions

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.

/home/myuser/public/

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 protected]/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?