Skip to content

Instantly share code, notes, and snippets.

@nedmas
Created December 12, 2013 14:27
Show Gist options
  • Save nedmas/7928714 to your computer and use it in GitHub Desktop.
Save nedmas/7928714 to your computer and use it in GitHub Desktop.
Simple shell script to set file permissions for a SilverStripe installation.
#!/bin/bash
if [ $# -lt 1 ]
then
echo "Usage : $0 [dir]"
exit
fi
chown -R dev:dev $1
find $1 -type d -exec chmod 755 {} \;
find $1 -type f -exec chmod 644 {} \;
find "$1/assets" -type d -exec chown www-data:www-data {} \;
find "$1/assets" -type d -exec chmod 755 {} \;
find "$1/assets" -type f -exec chown www-data:www-data {} \;
find "$1/assets" -type f -exec chmod 644 {} \;
find "$1/cache" -type d -exec chown www-data:www-data {} \;
find "$1/cache" -type d -exec chmod 755 {} \;
find "$1/cache" -type f -exec chown www-data:www-data {} \;
find "$1/cache" -type f -exec chmod 644 {} \;
find "$1/themes/*/_combinedfiles" -type d -exec chown www-data:www-data {} \;
find "$1/themes/*/_combinedfiles" -type d -exec chmod 755 {} \;
find "$1/themes/*/_combinedfiles" -type f -exec chown www-data:www-data {} \;
find "$1/themes/*/_combinedfiles" -type f -exec chmod 644 {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment