Setting Right Permissions on Website Files12 Mar 2016
So you set up your Apache or any other webserver on Linux or OS X? Ideally you want to grant access to your website files only for yourself as user and your webserver.
Here’s how it’s done:
chown -R [username] [directory]Grant permission to yourself
chgrp -R [apache-group] [directory]Grant permission to your webserver (e.g. Apache)
chmod -R 750 [website directory]Give just enough rights to avoid any vulnerability
chmod g+s [website directory]All new files get the webserver’s group
chmod g+w [website directory]Only necessary if the web server needs to write files in this folder