Server Fault is a question and answer site for system and network administrators. 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

To enforce the following permissions on files in /var/www, can I use the commands chmod u+s and chmod g+s?


chown -R root:web /var/www chmod -R g+rw /var/www

share|improve this question
up vote 2 down vote accepted

Setting the setgid bit on a directory will cause files and directories to inherit the group ownership of that directory. It will not have any impact on file or directory permissions.

File and directory permissions are controlled primarily by the process umask, which you can set for example in the Apache startup script.

To do what you want, you would first need to recursively set the setgid bit on all the directories in /var/www, and would would need to fix the permissions on existing files, and you would need to make sure all the existing files/directories have appropriate user and group ownership, and you would need to arrange for Apache to use the appropriate umask.

share|improve this answer
See this question for more information about setting the umask for Apache. – larsks Apr 3 '12 at 18:31
Thanks! What are your thoughts on this?… – Trent Scott Apr 3 '12 at 19:27
I've added some comments on that question. – larsks Apr 3 '12 at 20:04

Your Answer


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.