Skip to content

Instantly share code, notes, and snippets.

@sl-digital
Created September 26, 2016 16:07
Show Gist options
  • Save sl-digital/8c37f9b87073974b7dc03db29df50b23 to your computer and use it in GitHub Desktop.
Save sl-digital/8c37f9b87073974b7dc03db29df50b23 to your computer and use it in GitHub Desktop.
Webroot File Permissions
# Let Apache be initial owner
chown -R www-data:www-data /var/www/html
# Create an admin user
adduser admin
usermod -a -G sudo admin
usermod -a -G www-data admin
# Create a deployment user
adduser deployer
usermod -a -G www-data deployer
# Check the current ACLs
getfacl /var/www/html
# Set default ACL for admin user and www-data group
setfacl -Rd -m u:admin:rwx /var/www/html
setfacl -Rd -m g:www-data:rwx /var/www/html
# Set ACL for admin user and www-data group
setfacl -R -m u:admin:rwx /var/www/html
setfacl -R -m g:www-data:rwx /var/www/html
# Set default group for new content
chmod -R g+s /var/www/html
# Change folder permissions to rwxr-xr-x
find . -type d -exec chmod 755 {} \;
# Change file permissions to rw-r--r--
find . -type f -exec chmod 644 {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment