Skip to content

Instantly share code, notes, and snippets.

@EpocSquadron
Created August 3, 2012 14:12
Show Gist options
  • Save EpocSquadron/3247997 to your computer and use it in GitHub Desktop.
Save EpocSquadron/3247997 to your computer and use it in GitHub Desktop.
ExpressionEngine Permissions File
#!/bin/bash
# Find location of this script.
# This ensures that only files in the directory in
# which this script exists (recursively) are modified.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Set what the name of your expressionengine folders are.
SYSTEM="system"
IMAGES_DIR="public_html/images"
UPLOADS_DIR="public_html/files"
# Optionally ensure correct ownership on per environment basis.
#if [ "$DIR" = "/path/to/project/" ]; then
# chown -R http.http "$DIR"
#fi
# Expressionengine specific permissions.
find "$DIR" -type d -print0 | xargs -0 chmod 0755
find "$DIR" -type f -print0 | xargs -0 chmod 0644
find "$DIR/$IMAGES_DIR/" -type d -print0 | xargs -0 chmod -R go+w
find "$DIR/$UPLOADS_DIR/" -type d -print0 | xargs -0 chmod -R go+w
chmod -R go+w "$DIR/templates"
chmod -R go+w "$DIR/$SYSTEM/expressionengine/cache"
chmod 0666 "$DIR/$SYSTEM/expressionengine/config/config.php"
chmod 0666 "$DIR/$SYSTEM/expressionengine/config/database.php"
# Permissions specific to the sitemap generator
# from http://www.xml-sitemaps.com/.
#chmod -R 0777 "$DIR/public_html/generator/data"
#chmod 0666 "$DIR/public_html/sitemap.xml"
#chmod 0666 "$DIR/public_html/ror.xml"
# If laxative is being used, preserve executability
if [ -e "$DIR/.db/lax" ]; then
chmod 0700 "$DIR/.db/lax"
fi
# Make sure other shell scripts are executable too.
find "$DIR" -type f -name "*.sh" -print0 | xargs -0 chmod 700
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment