Skip to content

Instantly share code, notes, and snippets.

@CatEntangler
Last active January 11, 2018 19:36
Show Gist options
  • Save CatEntangler/3e753b07506db641661f to your computer and use it in GitHub Desktop.
Save CatEntangler/3e753b07506db641661f to your computer and use it in GitHub Desktop.
WordPress with Git Permissions updater shell file
#!/bin/bash
username="WEBSERVERUSER"
adminuser="ADMINISTRATIVEUSER"
group="ADMINISTRATIVEGROUP"
sudo chown ${username}:${group} -R .
sudo find . -type d -exec chmod 570 {} \;
sudo find . -type f -exec chmod 470 {} \;
sudo chown ${adminuser}:${group} .permissions.sh
sudo chown ${adminuser}:${group} -R .git
sudo chmod 770 .permissions.sh
sudo chmod 770 -R .git
sudo chmod 770 -R wp-content/uploads
sudo chmod 770 -R wp-content/cache
sudo chmod 770 wp-content/wp-cache-config.php
sudo chmod 770 wp-content/advanced-cache.php
sudo chmod 770 wp-content/debug.log
@CatEntangler
Copy link
Author

Place in the WordPress root directory.

@CatEntangler
Copy link
Author

Changed name to .permissions.sh in my setups. permissions updates now includes this.

@CatEntangler
Copy link
Author

Updated to be default WordPress setup compliant (will need to throw Maje's content directory one somewhere else).

Removed the initial change everything to 470 because that potentially breaks directory execution

Changed the order of things for aesthetic/readability reasons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment