Super User is a question and answer site for computer enthusiasts and power users. 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

My DocumentRoot is set to /var/workspace/www

drwxrwx--- 110 radek www-data 4096 Jul 11 11:34 www

Firstly i had 777 permissions on that folder (and all files inside), but i don't like it, because everyone can see it and change it.

As Apache runs under user www-data:www-data, i tried to set the group and permissions:

sudo chgrp www-data www -R
sudo chmod 770 www -R

After i done that, http://localhost started to show 403 - Forbidden. It just looks like apache is taken as "other" (from owner, group, other) in words of permissions.

What should i change (permissions, owners, whatever) to keep all files visible and changable only for me (user radek) and executable by apache?

As i can see, there's one Apache process running under root and many others under www-data.

radek@me:/$ ps -Af | grep apache
root     13165     1  0 11:37 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 13173 13165  0 11:37 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 13174 13165  0 11:37 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 13175 13165  0 11:37 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 13176 13165  0 11:37 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 13177 13165  0 11:37 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 13190 13165  0 11:37 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 13194 13165  0 11:37 ?        00:00:00 /usr/sbin/apache2 -k start

Is the first process the reason of problems described above?

share|improve this question
up vote 0 down vote accepted

Apache (and many other daemons) start as root and then switch to another user. this is correct. user permissions 755 should be right (owner has read write and execute.. or 4 2 and 1... group has read and execute... and others have read and execute)

your 770 setting means

owner has read write execute. group has read write and execute. everyone else has nothing.

it will always issue a 403 under those settings.

if you want a specific user to have read write access then you have to chown it to that user.

share|improve this answer
dont be afraid to tweak the permissions... just remember if users accessing the site are always going to be on the "other" permissions – steve Jul 12 '11 at 21:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .