1

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

2

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.

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.