To reset filepermissions of Magento, you can run these commands on shell from within the Magento root folder:
$> #for magento 1.5+
$> find . -type f -exec chmod 644 {} \;
$> find . -type d -exec chmod 755 {} \; //if shelluser for checkout != apacheuser => 775
$> chmod o+w var var/.htaccess app/etc //if shelluser for checkout != apacheuser => og+w
$> chmod 550 mage
$> chmod -R o+w media //if shelluser for checkout != apacheuser => og+w
$> rm -rf var/cache/*
$> rm -rf var/session/*
perhaps you have to use sudo!!!
As a bash script
Or you can place all commands in a shellscript like the following one. I personally put these kind of tools in a folder tools/shellscripts that is situated on the same level as the Magento DocumentRoot (here mage). That’s why the paths have to start with ../../ .
#!/bin/bash
if [ "$1" == "help" ]
then
echo "Help";
echo "USAGE:";
echo "========";
echo "reset_permissions.sh APACHEUSERGROUP";
exit 0;
elif [ $1 ]
then
find ../../mage/ -type f -exec chmod 0644 {} \;
chmod 550 ../../mage/mage
#wenn shelluser für checkout == apacheuser dann 755
find ../../mage/ -type d -exec chmod 2775 {} \;
rm -rf ../../mage/var/cache/*
rm -rf ../../mage/var/session/*
find ../../../../shared/mage/ -type d -exec chmod 2775 {} \;
find ../../../../shared/mage/ -type f -exec chmod 0644 {} \;
echo "Magento file permissions were resetted!";
else
echo "You have to give me the right params, please sir master sir!!!";
exit 0;
fi
