Skip to content

Instantly share code, notes, and snippets.

@leek
Created September 30, 2013 15:50
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save leek/6765850 to your computer and use it in GitHub Desktop.
Save leek/6765850 to your computer and use it in GitHub Desktop.
Magento - Simple reset file permissions script
#!/bin/bash
#
# Found on StackOverflow:
# http://stackoverflow.com/a/9304264/3765
#
if [ ! -f ./app/etc/local.xml.template ]; then
echo "-- ERROR"
echo "-- This doesn't look like a Magento install. Please make sure"
echo "-- that you are running this from the Magento main doc root dir"
exit
fi
if [ `id -u` != 0 ]; then
echo "-- ERROR"
echo "-- This script should be run as root so that file ownership"
echo "-- changes can be set correctly"
exit
fi
find . -type f \-exec chmod 644 {} \;
find . -type d \-exec chmod 755 {} \;
find ./var -type d \-exec chmod 777 {} \;
find ./var -type f \-exec chmod 666 {} \;
find ./media -type d \-exec chmod 777 {} \;
find ./media -type f \-exec chmod 666 {} \;
chmod 777 ./app/etc
chmod 644 ./app/etc/*.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment