simple script to correct wordpress permissions

Script


#!/bin/bash
loc=$1

echo "finding and correcting directory perms"
find "$loc" -type d -exec chmod 755 {} \;
#copy htaccess to wp-root
cp /root/wp-root-htaccess "$loc/.htaccess"
#copy uploads htaccess to uploads
cp /root/wp-uploads-htaccess "$loc/wp-content/uploads/.htaccess"
#echo "$loc"
echo "finding and correcting file perms"
find "$loc" -type f -exec chmod 644 {} \;

wp-root-htaccess


#protect wp-config
<files wp-config.php>
order allow,deny
deny from all
</files>

wp-uploads-htaccess


# Kill PHP Execution
<Files ~ "\.ph(?:p[345]?|t|tml)$">
   deny from all
</Files>

Leave a Reply

Your email address will not be published. Required fields are marked *