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 a noob here. I would like to know whether I will have any issues if I change ownership of /var/www to www-data, and what is the significance of www-data?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

/var/www traditionally holds the necessary files to serve a website using a HTTP server such as Apache. Apache is executed by the user www-data, so interactive elements of the website (e.g., PHP scripts) have write access to pretty much everything owned by www-data.

Owning /var/www by www-data is undesirable by the principle of least privilege. There's usually no need for a PHP script able to modify itself or other parts of the website.

If, for some reason, www-data needs to be able to modify or create some files, you can grant write permissions to those specific files (for modification) or write and execution permissions to a folder (for file creation) by owning them.

share|improve this answer
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.