Skip to content

Instantly share code, notes, and snippets.

@anunay
Forked from monkishtypist/wp_permissions.sh
Created July 20, 2023 07:58
Show Gist options
  • Save anunay/25d28782200f51cfdb143577b1a88ec1 to your computer and use it in GitHub Desktop.
Save anunay/25d28782200f51cfdb143577b1a88ec1 to your computer and use it in GitHub Desktop.
WordPress file/folder permissions for Amazon EC2 Ubuntu instance
#!/bin/bash
# Location: Anywhere
# Add existing 'ubuntu' user to 'www-data' group
sudo usermod -a -G www-data ubuntu;
# Set the ownership of the files/directories
sudo chown -R www-data:www-data /var/www/html/;
# Set group ownership inheritance
sudo chmod g+s /var/www/html/;
# Set the permissions of the files/directories
sudo find /var/www/html/ -type d -exec chmod 755 {} \;
sudo find /var/www/html/ -type f -exec chmod 644 {} \;
# Give `write` permissions to the group (for editing files via FTP)
sudo chmod -R g+w /var/www/html/;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment