So I made the mistake of making everything 777 on my local machine. I then zipped everything, uploaded the file via FTP to my server, then used SSH to unzip it. Now everything is 777, which is obviously bad.

I figured I could do something like chmod 644 * -R, then 666 and 777 on the things that needed it. However doing 644 gives me permission denied (755 works, but I assume that is not very safe either, or?)

What should the file permissions of all files (except the 666/777 ones) be? And is there a fast way of setting them?


You can make batch file for this - ee_permissions.sh


# 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.

# Optionally ensure correct ownership on per environment basis.
#if [ "$DIR" = "/path/to/project/" ]; then
#   chown -R http.http "$DIR"

# 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"

# Make sure other shell scripts are executable too.
find "$DIR" -type f -name "*.sh" -print0 | xargs -0 chmod 700

another example of shell_script for the same.

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.