Skip to content

Instantly share code, notes, and snippets.

@christianrojas
Last active August 29, 2015 13:55
Show Gist options
  • Save christianrojas/8783674 to your computer and use it in GitHub Desktop.
Save christianrojas/8783674 to your computer and use it in GitHub Desktop.
Wordpress owner group and permissions
#!/bin/bash
PATH=/path/to/WP/folder
echo "chown entire wp folder"
chown -R -f www-data:www-data $PATH
echo "securing the entire wp folder"
find $PATH -type d -exec chmod 755 {} \;
find $PATH -type f -exec chmod 644 {} \;
chmod 440 $PATH/*.php # verified minimum OK with WP
find $PATH/wp-admin -type f -exec chmod 640 {} \;
find $PATH/wp-includes -type f -exec chmod 640 {} \;
chmod 440 $PATH/.htaccess
chmod 766 $PATH/sitemap.*
chown -R -f www-data:www-data $PATH/wp-content/uploads
chmod 777 -R $PATH/wp-content/uploads
find $PATH/wp-content/uploads -type f -exec chmod 660 {} \;
chmod 770 -R $PATH/wp-content/upgrade
chmod 750 -R $PATH/wp-content/plugins
find $PATH -name 'index.php' -exec chmod 440 {} \;
echo "Done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment