I was trying to install a patch through SSH and followed the directions to change folder permissions; it came up saying

operation not permitted

but now my site is down with a

403 - Forbidden Error

I am going through each folder manually trying to change the folder permissions back to 755 and the file permissions back to 644 but it's

  1. Taking forever
  2. More than possible that some will be missed.

Please help! How do I revert them all back?

Will typing this into my terminal help?

find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
chmod 550 mage

I'm scared to touch SSH again. Can someone help me get it back?

  • Thanks. Am just trying the code above into terminal now. May 21, 2015 at 8:39
  • It's okay; that terminal code did it - i'm back up and running! PHEW!! Now I can finally sleep! Thank you for offering to help. I promise to never touch SSH again - it's way too powerful! May 21, 2015 at 8:42
  • Congrats man :) Have a good sleep May 21, 2015 at 8:44
  • I promise to never touch SSH again , then i guess patching magento is pointless in your case....
    – user2857
    May 21, 2015 at 22:48

1 Answer 1


While these permissions will get your site to work

find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
chmod 550 mage

They are certainly not recommended for you to use such wide open permissions. Before you start changing permissions you should understand what you are changing and why. The above example gives a lot of privileges to all your files and folders.

You should experiment with your permissions and to keep them as restrictive as possible. For example, most of your files can run with 440 (You can test)

Note from Magento suggestions here http://devdocs.magento.com/guides/m1x/install/installer-privileges_after.html

find . -type f -exec chmod 400 {} \;
find . -type d -exec chmod 500 {} \; 
find var/ -type f -exec chmod 600 {} \; 
find media/ -type f -exec chmod 600 {} \;
find var/ -type d -exec chmod 700 {} \; 
find media/ -type d -exec chmod 700 {} \;
chmod 700 includes
chmod 600 includes/config.php

You see that you regular files are not writable at all, only your media and var folders. If you are on a shared server you may have to change the second bit to something other than "0"

If the above example does not work then you can try:

find . -type f -exec chmod 440 {} \;
find . -type d -exec chmod 550 {} \; 
find var/ -type f -exec chmod 640 {} \; 
find media/ -type f -exec chmod 640 {} \;
find var/ -type d -exec chmod 750 {} \; 
find media/ -type d -exec chmod 750 {} \;
chmod 750 includes
chmod 640 includes/config.php

It is important that you don't leave your site wide open to the world!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.