0

I have changed my DocumentRoot to ~/www. The permissions of it are 0774. I have added the www-data user to my user's group and the owner of ~/www is my own user and group (user:user).

The problem is that apache can't write to this directory. It can write only if I set www-data as owner, but if I do that, I can't write at the directory. The opposite thing applies too.

This is more like a Linux question, not Ubuntu but I really hope that you can help me. Thanks!

Stanislav
  • 223

1 Answers1

3

There are two ways to solve this. One is definitely preferred over the other.

The preferred method:

Chown the DocumentRoot directory so that www-data is the owner chown -R www-data:www-data ~/www. Then set the permissions so that anyone in the www-data group can read and write to the directory 775 is a good choice.

Then add yourself to the www-data group sudo adduser <username> www-data

Log out and back in for changes to take effect, now you and apache can write to the directory

You could also solve this problem changing the apache user and group to your user and group, but that's just a bad idea.

Dan
  • 6,784