Here’s how to reset your file and directory permissions if PHP is running through FastCGI, suPHP, or LSAPI:

find . -type f -exec chmod 644 {} ;
find . -type d -exec chmod 755 {} ;
chmod 550 pear
If PHP is running as a module (DSO), you will need to do this:

find . -type f -exec chmod 644 {} ;
find . -type d -exec chmod 755 {} ;
chmod o+w var var/.htaccess includes includes/config.php app/etc
chmod 550 pear
chmod -R o+w media
The above commands need to be executed from the root directory where Magento is installed.

If you do not have access to SSH:

Download Magento Cleanup Tool
Unzip magento-cleanup.php to the root directory where Magento is installed.
Browse to http://yourdomain.com/magento/magento-cleanup.php