Skip to content

Instantly share code, notes, and snippets.

@SamuelRiversMoore
Last active October 21, 2020 12:39
Show Gist options
  • Save SamuelRiversMoore/cb2cc8b6e09fea8880fbaeca47c59dca to your computer and use it in GitHub Desktop.
Save SamuelRiversMoore/cb2cc8b6e09fea8880fbaeca47c59dca to your computer and use it in GitHub Desktop.
#set variable
site_folder="kirby"
# 1- Recursively change group ownership of the folder to the apache group
sudo chown -R :www-data $site_folder
#2- Change chmod of root folder and then for all its subdirectories and files
sudo chmod 770 $site_folder
find $site_folder -type d -exec sudo chmod 770 {} +
find $site_folder -type f -exec sudo chmod 660 {} +
#3- Set the stick bit for the group
sudo chmod g+s $site_folder
find $site_folder -type d -exec sudo chmod g+s {} +
#4- Set access control list
sudo setfacl -R -d -m u::rwx -m g::rwx -m o::- $site_folder
unset $site_folder
#set variable
site_folder="kirby"
sudo chown -R :www-data $site_folder && sudo chmod 770 $site_folder && find $site_folder -type d -exec sudo chmod 770 {} + && find $site_folder -type f -exec sudo chmod 660 {} + && sudo chmod g+s $site_folder && find $site_folder -type d -exec sudo chmod g+s {} + && sudo setfacl -R -d -m u::rwx -m g::rwx -m o::- $site_folder && unset $site_folder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment