Magento – Magento uploaded images and 777 permissions

cacheimage-uploadmagento-1.9permissions

When I upload images from Magento 1.9 products page, they get permissions 777. I also found a few other 777 folders, such as media/catalog/product folders, and cached images.

Also var/cache folders are created with 777, files inside are 600.

I've run the following to make all my folders 644 and all the files 755:

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

After the above, I still get new uploaded images with 777 permissions.

Any ideas?

  • Update #1: Checked Mage_Cache_Backend_File, files are set on 644 and folders on 755.

  • Update #2: Checked umask, was 022, also added it to ~/.bashrc, no change.

  • Update #3: changed umask(0) to umask(022) in index.php.

When I upload a new image, i.e. demo.jpg, then the first folder gets created with 755 params:

media/catalog/product/d 755
media/catalog/product/d/e 777
media/catalog/product/d/e/demo.jpg 777

Edit:

As Fiasco Labs proposed, I searched with Notepad++ inside files for 0777 entries and changed them to 0644 or 0755 depending if files/folders.

It resulted as the first folder created to be 755 and the second folder to 777, but the files inside are now 644. So, issue is almost solved, need to dig a bit more.

So I re-set the permissions from time to time just to be sure it's OK.

Best Answer

You can download magentocleanup.php and run the file to set the correct Files/Folder permission.

Related Topic