Super User is a question and answer site for computer enthusiasts and power users. 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

I have set up a LAMP environment. All of the files that I want to run on the localhost are placed into my /var/www directory. Each time I want to open up a file with write permissions, I have to prefix the command with sudo at the beginning. How do I change the permissions of /var/www so any user other than root can modify the contents?

share|improve this question
up vote 1 down vote accepted

The simplest way is to change the ownership to your userid. This should not be user id the webserver is accessing the files you are using. Use the chown command recursively. Try a command like:

sudo chown -R $LOGNAME /var/www

This will recursively change the /var/www directory tree to your userid. LOGNAME is normally set to your userid. This can be verified with the command echo $LOGNAME.

Limit write access by the web server to as few directories and files as possible.

share|improve this answer
Thank you very much. – egidra Nov 1 '11 at 3:25

You must log in to answer this question.

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