5

I am used to adding sites in /home/USR/public_html. But now I have decided to put sites into /var/www/site1, /var/www/site2, and so on.

Root owns /var/www/, but you want your user to be able to work in this location so are these the right steps in order give a user permissions? Security wise, is this the right way, or is there a better way?

This is a drupal multisite 1 core instance. Virtual hosts are used, but all drupal sites sit in 1 folder under the drupal core code.

sudo adduser bob www-data
sudo chown -R www-data:www-data /var/www
sudo chmod -R g+rw /var/www
joe
  • 55

1 Answers1

3

You approach will accomplish your goals with the given file hierarchy, and is reasonably secure.

If security is your primary concern, keeping the sites in /home/$USER/public_html is probably advisable. It's a well-known convention (aids maintainability), avoids splitting user data across multiple, un-related hierarchy (aids maintainability and helps automate backup routines), and requires less manual intervention (i.e. less mistakes--say you type 'o' instead of 'g' in your chmod command and don't notice).

If you've changed the file structure as part of a transition away from single-user sites, you might want to investigate vhosts.

cqcallaw
  • 1,123