Skip to content

Instantly share code, notes, and snippets.

@taddev
Last active August 29, 2015 13:56
Show Gist options
  • Save taddev/8809515 to your computer and use it in GitHub Desktop.
Save taddev/8809515 to your computer and use it in GitHub Desktop.
A series of scripts to manage the permissions for various wordpress directories in bulk. The *lock* scripts will remove write access to the files while the *unlock* scripts will add it.
#!/bin/bash
LOCKFILE="/home/tad/scripts/.unlocked_wp-content"
WPDIR="/var/www/localhost/htdocs/blog/wp/wp-content"
if [ -f $LOCKFILE ]; then
echo "Locking WP-Content Directory"
find $WPDIR -type f -exec chmod 644 {} \;
find $WPDIR -type d -exec chmod 755 {} \;
rm -f $LOCKFILE
else
echo "WP-Content Directory Already Locked"
fi
#!/bin/bash
LOCKFILE="/home/tad/scripts/.unlocked_wp-content"
WPDIR="/var/www/localhost/htdocs/blog/wp/wp-content"
if [ ! -f $LOCKFILE ]; then
echo "Unlocking WP-Content Directory"
find $WPDIR -type f -exec chmod 664 {} \;
find $WPDIR -type d -exec chmod 775 {} \;
touch $LOCKFILE
else
echo "WP-Content Directory Already Unlocked"
fi
#!/bin/bash
LOCKFILE="/home/tad/scripts/.unlocked_wp-content"
WPDIR="/var/www/localhost/htdocs/blog/wp/wp-content"
if [ ! -f $LOCKFILE ]; then
echo "Unlocking WP-Content Directory"
find $WPDIR -type f -exec chmod 664 {} \;
find $WPDIR -type d -exec chmod 775 {} \;
touch $LOCKFILE
else
echo "WP-Content Directory Already Unlocked"
fi
!/bin/bash
LOCKFILE="/home/tad/scripts/.unlocked_wp"
LOCKCONTENT="/home/tad/scripts/.unlocked_wp-content"
WPDIR="/var/www/localhost/htdocs/blog/wp/"
if [ ! -f $LOCKFILE ]; then
echo "Unlocking WP Directory"
find $WPDIR -type f -exec chmod 664 {} \;
find $WPDIR -type d -exec chmod 775 {} \;
touch $LOCKFILE
if [ ! -f $LOCKCONTENT ]; then
touch $LOCKCONTENT
fi
else
echo "WP Directory Already Unlocked"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment