Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm setting up a sandbox type of server that will be used by a couple users as a development environment and knowledge base. The server will have a web frontend so I've installed Apache, MySQL and PHP.

Out of the box, everything under /var/www is owner by root:root. I haven't run a web server in a while but I'm pretty sure this isn't the best way of doing things. I vaguely remember the www-data user existing.

How can I get apache et al. to run as these users and have files in /var/www owned by that user and group (to which I can add my own user too)?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Each major OS distro supplies Apache preconfigured slightly differently. It's up to you to decide how you want your security to be configured.

If you're using a vendor supplied Apache package, try looking at the main .conf file (under Ubuntu it's called apache2.conf). Look for the User and Group directives. Either change the User and Group to the user/group that you want to own the files, or chown -R <apache user>:<apache group> /var/www.

If you're looking to allow multiple users to edit files in /var/www then you'll probably have to get creative. You could:

  • Make sure that the files in /var/www have their group set to a group that all your editing users are in.
  • Let editing users sudo to the www user to edit files.
  • Set ACLs on the files in /var/www to permit users to edit specific files.
share|improve this answer
    
Welcome to the website! And thanks for your answer, it's exactly what I was looking for. Cheers. –  maxmackie Jan 27 '13 at 9:03

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.