Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
share|improve this question
    
Do you mean to say that you have separate clients - each with a website to operate themselves (you are hosting) - or somehting different like many web sites with one or more developers per site? –  user8290 Feb 5 '12 at 1:36

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
Well to be specific, 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. So there will be no splitting up of user data. Are there any other benefit besides less mistakes in this case? If you are hosting multiple unrelated sites, it makes sense to me to use USER homes, but if you have multiple related-one-domain-specific sites, it makes more sense to put them into /var/www/mysite/. This is how it makes sense in my head. Is that way off? Or would you still use USER homes? –  joe Feb 5 '12 at 6:01
    
Sounds like you're on the right track for the scenario you describe. Would you mind adding those details to your original question? It'll make it much more useful to the community. –  cqcallaw Feb 6 '12 at 4:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.