The mode for both these directories is 755. I'd like to restrict permissions to 754. But if I do so, I'm thinking the apache www-data instance won't be able to access the directories to serve the contained files.

  1. Is there a canonical mode for these directories. 2. What's a good way to provide the apache instance access: through creating some sort of group?

Do not change the chmod for /varas this should remain default.

Apache runs on the usergroup www-data so /var/www should have the owner has www-data and not root, if this is the case then 754 is absolutely fine.

This may help:

chown www-data:www-data /var/www
chmod -R 754 /var/www

Normally this is set-up for you if you used an installer such as apt-get when installing Apache or nginx.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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