Skip to content

Instantly share code, notes, and snippets.

@mthabsheer
Created May 28, 2019 11:28
Show Gist options
  • Save mthabsheer/6789851209119371a7a43e1ea8aeb4ab to your computer and use it in GitHub Desktop.
Save mthabsheer/6789851209119371a7a43e1ea8aeb4ab to your computer and use it in GitHub Desktop.
Allow Apache access to the folders and the files.
sudo chgrp -R www-data /var/www/html
sudo find /var/www/html -type d -exec chmod g+rx {} +
sudo find /var/www/html -type f -exec chmod g+r {} +
Give your owner read/write privileges to the folders and the files, and permit folder access to traverse the directory structure.
sudo chown -R USER /var/www/html/
sudo find /var/www/html -type d -exec chmod u+rwx {} +
sudo find /var/www/html -type f -exec chmod u+rw {} +
(Optional) Make sure every new file after this is created with www-data as the 'access' user.
sudo find /var/www/html -type d -exec chmod g+s {} +
(Optional) Final security cleanup, if you don't want other users to be able to see the data
sudo chmod -R o-rwx /var/www/html/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment