Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I run ls -l on the www folder and everything that's inside, I see that root:root are the owner/group

When I run ps aux | grep apache2, I get the first process owned by root (I assume this is normal, but why is it owned by root and not www-data?) and I get 6 other processes owned by www-data.

Now, since the ls -l /var/www shows -rw-r--r--, it should mean that www-data has no write privileges since it's in "world" (and also not in the "root" group).

But if, in my web application, users can upload images, I imagine there should be a folder inside /www called "uploadedpics/" on which www-data would have write privileges, is that right?

So if user and group are root:root for the /www folder, how can I create a subdirectory in which www-data can write?

Thanks a lot for your help

share|improve this question
up vote 1 down vote accepted

The first Apache process being owned by root is an artifact of earlier days of computing on Linux where the root user was the only account which can bind to ports under 1024. The progresses that serve content run under the www user.

To allow write access to a folder change the owner or group to the www user and chmod 775 or similar.

share|improve this answer
Hi, thanks for your response. So would that mean that the permission of subdirectory would take precedence over permissions of parent folder? Thanks – ericd Sep 21 '12 at 1:33
@eric01 - yes exactly. – Tim Brigham Sep 21 '12 at 1:54

You can change the new folder group to www-data (sudo chgrp www-data <your-folder>) and give w permission to the group (sudo chmod g+w <your-folder>).

Another way (wich I prefer) is to use ACLs (man setfacl for more details if you want to go that way).

share|improve this answer

Your Answer


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.