Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 6 down vote accepted

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.

share|improve this answer
    
Yes, I figured that chmod was the way to go. I'll try also your recommendation of adding a user to the group. Cheers –  Got The Fever Media Sep 27 '13 at 7:57

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.