Setup Magento Permissions Script
Posted by Martijn on 25 November, 2008
2 Comments
This item was filled under [ Tutorials ]
Magento permissions can be an absolute pain! Use one of the solutions below to setup Magento permissions easily.
1. SSH Script
#!/bin/bash
find www -name .htaccess -exec chmod 604 {} ;
find www -name *.php -exec chmod 644 {} ;
find www -type d -exec chmod 705 {} ;
2. SSH Command Line
find ./ -type d -exec chmod 755 {} \; && find ./ -type f -exec chmod 644 {} \;
3. PHP Permissions Script
<?php
system(‘chmod -R 744 *’);
system(‘find . -type d -exec chmod 755 {} \;’);
?>



(4.94 out of 5)
2 Comments on “Setup Magento Permissions Script”
Hello,
I am trying to install Magento and am still having permissions problems. Where do I place these scripts for them to work. ( I am pretty new to programming).
Thanks,
Brian
Hi Brian,
If you have access to the SSH command line then the best (easiest) option would be to login and run the second command. You’ll need to ask your host if you can have SSH access.
find ./ -type d -exec chmod 755 {} \; && find ./ -type f -exec chmod 644 {} \;
You can also set the permissions via FTP by chmod 777 on these directories:
* magento/app/etc
* magento/media
* magento/var
* magento/var/.htaccess
If you installed sample data you’ll need to chmod 777 any files in magento/media also.
Again if you’re having trouble it’s probably best to ask your webhost who can set these permissions directly for you.
Hope this helps, ask if you need anything else.
Stefan