Resetting File Permissions

Last modified by Brent W Peterson on Fri, June 6, 2014 14:50
Source|Old Revisions  |  Back To Group

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

As many times as I add a backslash before the ; it removes it. ADD A BACKSLASH “” before the ;!!

  1. find . -type f -exec chmod 644 {} ;
  2. find . -type d -exec chmod 755 {} ;
  3. chmod 550 pear
  4. chmod 550 mage #for magento 1.5+

If PHP is running as a module (DSO), you will need to do this:

  1. #for magento 1.5+
  2. sudo find . -type f -exec chmod 644 {} ;
  3. sudo find . -type d -exec chmod 755 {} ;
  4. sudo chmod o+w var app/etc
  5. sudo chmod 550 mage
  6. sudo chmod -R o+w media

If you are running Pre 1.5 you can copy and paste this

  1. find . -type f -exec chmod 644 {} ;
  2. find . -type d -exec chmod 755 {} ;
  3. chmod o+w var var/.htaccess app/etc
  4. chmod 550 pear
  5. chmod -R o+w media

The above commands need to be executed from the root directory where Magento is installed.

Note that the wiki software on this site seems to have some sort of double escaping issue that keeps removing the backslash before ; at the end of the ‘find . -type ...’ lines. Every time you edit this page, you’ll have to restore them by making sure there are three slashes before each semicolon that should have a backslash before it! See for details.

If you do not have access to SSH:

  1. Unzip magento-cleanup.php to the root directory where Magento is installed.

!!! In Magento Version 1.5. you need to change magento-cleanup.php:

  chmod("pear", 550);
  chmod("lib/PEAR", 550);

[Added by Pedro Machado on 2011/07/05] I got errors with the SSH option above, so you may need like me to cleanup session and cache folders:

  1. rm -rf var/cache/*
  3. rm -rf var/session/*

And set the var folder to 755:

  1. chmod 755 -R var


Magento 2 GitHub Repository

Magento Job Board - Some sort of tag line goes here

Latest Posts| View all Jobs