Skip to content

Instantly share code, notes, and snippets.

@nedmas
Last active December 19, 2015 21:19
Show Gist options
  • Save nedmas/6019363 to your computer and use it in GitHub Desktop.
Save nedmas/6019363 to your computer and use it in GitHub Desktop.
Simple shell script to set file permissions for a Magento 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/app/etc" -type d -exec chown dev:www-data {} \;
find "$1/app/etc" -type d -exec chmod 775 {} \;
find "$1/app/etc" -type f -exec chown dev:www-data {} \;
find "$1/app/etc" -type f -exec chmod 664 {} \;
find "$1/includes" -type d -exec chown dev:www-data {} \;
find "$1/includes" -type d -exec chmod 775 {} \;
find "$1/includes" -type f -exec chown dev:www-data {} \;
find "$1/includes" -type f -exec chmod 664 {} \;
find "$1/var" -type d -exec chown dev:www-data {} \;
find "$1/var" -type d -exec chmod 775 {} \;
find "$1/var" -type f -exec chown dev:www-data {} \;
find "$1/var" -type f -exec chmod 664 {} \;
find "$1/media" -type d -exec chown dev:www-data {} \;
find "$1/media" -type d -exec chmod 775 {} \;
find "$1/media" -type f -exec chown dev:www-data {} \;
find "$1/media" -type f -exec chmod 664 {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment