Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

I've been around Ubuntu for not too long now and I'm getting tired of a thing I used to accept. When I installed Apache and PHP on Ubuntu it was done with root meaning it got permission. So I changed that to me. Now I've just copied a big number of files, (PHP), to be viewed and edited in these directories. Now my problem: I can not view the files from var/www/ because it requires, for some reason, everyone to have access to the files. Not only me, or my group but everyone. No one else is using the computer but me, so I'm cool with it. Though I need a command to change ALL files permission recursively. When I've browsed the questions already been answered I find for example chown -R viktor:viktor /var/www/, or using sudo as well.

This worked on the single var/www and the folders inside but not the files inside the folders and very odd I notice I can't do the same thing on example /var/www/dev/.

share|improve this question

marked as duplicate by Lekensteyn, con-f-use, Tom Brossman, Takkat, Jorge Castro Oct 30 '12 at 10:12

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.

1 Answer 1

I actually suggest NOT following Evandro's answer, because not only does it give permission to yourself, it gives open permission to any application or entity on your computer, including those which may have malicious intent. Especially if you're running a web server, you'll want to avoid having open permissions like that. I suggest giving read listing permissions to other users and full access, including write to yourself.

sudo chmod -R 755 /var/www

Which will give you web-appropriate permissions recursively throughout your web directory.

share|improve this answer
    
sorry, made that in a hurry >) –  Evandro Silva Oct 29 '12 at 17:03

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