7

I'm using Debian Wheezy. I've installed apache, php, mysql, the works. It works properly but for permissions that I need to set.

so I have my sites in /var/www/mysite, and I'm struggling between the permissions I should leave for apache and for my normal user. I want apache to be able to create/access files and folders, and I also need my normal user to be able to update, edit, create files and folders.

I've tried these combinations:

chown -R www-data:www-data mysite/ but that doesnt let my user do anything on the files

chown -R www-data:user mysite/ somethings wrong too

chown -R user:www-data mysite/ wrong too

Right now I have this setting:

chown -R user:user mysite/ but then on stuff newly created by apache, my browser cant load these assets and the server returns an error 403

Would be glad for some help

Thanks

1 Answer 1

14

I think the best way to do this is to do use your first option:

chown -R www-data:www-data mysite/ 

But then add your user to the www-data group

usermod -a -G www-data user

and then give the group control over the files

chmod 770 -R /var/www/mysite

Chmod 770 basically means both the user who owns the file (in this case www-data) can do read-write-execute and all users in the group assigned to the file (in this case www-data as well) can do read-write-execute.

1
  • Yes, I figured that chmod was the way to go. I'll try also your recommendation of adding a user to the group. Cheers Commented Sep 27, 2013 at 7:57

You must log in to answer this question.

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