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 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
add comment

1 Answer

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
add comment

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.