Skip to content

Instantly share code, notes, and snippets.

@smcelhinney
Last active August 29, 2015 14:00
Show Gist options
  • Save smcelhinney/11288301 to your computer and use it in GitHub Desktop.
Save smcelhinney/11288301 to your computer and use it in GitHub Desktop.
Recursive bash directory permissions for Apache vhosts.
dir=/home/somevhostdomain.com/htdocs/;
while true; do
# the exit case when we get to the top level directory /
if [ -z "$dir" -o "$dir" = "/" ]; then
break;
fi;
echo chmodding o+x $dir;
# make the directory exectuable (openable) by others
chmod o+x $dir;
# go 'up' a directory
dir=`dirname $dir`;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment