7

Possible Duplicate:
How to avoid using sudo when working in /var/www?

Permissions mystify me. I'm worried about compromising the security of my folder, too, since it's public.

15

To give only your user permission to /var/www. You want to change the group owner to your primary group. If your username is joe this is how you would do it.

sudo chgrp joe /var/www

You then need to chmod the directory so its writable by the group joe.

sudo chmod 775 /var/www

after that you can write to /var/www

If you want to be able to edit and delete existing files. You need to take ownership of them.

sudo chown -R joe /var/www/*
| improve this answer | |
  • That seems to have worked, but it didn't affect the existing files in /var/www, i.e. I'm still getting "permission denied" when trying to modify anything I have in /var/www. How can I apply these permissions recursively to everything in /var/www? – Jonathan Jan 10 '13 at 18:32
  • for existing files I would take ownership of them. simply do something like sudo chown -R joe /var/www/* . you can in theory just change owner of /var/www to joe and then re-curse down, however I like to keep directories like this owned by root, which means you can not recursively delete the whole directory. – strings Jan 10 '13 at 18:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.