Skip to content

Instantly share code, notes, and snippets.

@devsli
Last active August 29, 2015 14:06
Show Gist options
  • Save devsli/053f36c20d0bbb6e44a9 to your computer and use it in GitHub Desktop.
Save devsli/053f36c20d0bbb6e44a9 to your computer and use it in GitHub Desktop.
Recursive site permissions set
#!/bin/sh
if [ "$1" = "" ]; then
echo "usage: $0 website-dir";
echo;
# echo "Set owner of <website-dir> to www:nogroup,";
echo "Set permissions rw-r-r for regular files";
echo "and rwx-rx-rx for directories";
echo;
echo "Root permissions might be required.";
exit 1;
fi;
if [ ! -d $1 ]; then
echo "$1: is not a directory";
exit 1;
fi;
# chown -R www:nogroup $1
# chown -R apache:apache $1
find $1 -type d -exec chmod 755 {} \;
find $1 -type f -exec chmod 644 {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment