0

Has anyone written a shell script to set all the default file/folder permissions on a new EE install?

0

You can create .sh file and use below command to set permissions to folders.

chmod -Rvf 0777 folder_path/folder_name/
1
0

You can modify next scripts for your needs:

source

#!/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/$SYSTEM/user/templates"
chmod -R go+w "$DIR/$SYSTEM/user/cache"
chmod 0666 "$DIR/$SYSTEM/user/config/config.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"
#chmod 0600 "$DIR/public_html/index.php"


# 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.