Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

Permissions:

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

share|improve this question

1 Answer 1

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? stackoverflow.com/questions/10000023/… –  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

 
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.