Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

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.

share|improve this question

marked as duplicate by Jorge Castro, Luis Alvarado, Javier Rivera, Flimm, Chris Wilson Jan 10 '13 at 19:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 8 down vote accepted

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/*
share|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? – Jon 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.