Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What permissions are needed to run Magento?

Tags:

magento

The Magento documentation tells us to do this:

chmod -R o+w media var
chmod o+w app/etc

That gets us past the installer.

Next, I'd like to download a theme from Magento Connect. Unfortunately, that is throwing an error that seems to be permissions related.

Settings has not been loaded. Used default settings
Config file does not exists please save Settings
Warning: Your Magento folder does not have sufficient write permissions.

What permissions are needed to get past that?

I'm also seeing an error about the connection string.

Connection string is empty

While we are at it, what are the total set of permissions that must be set to make Magento fully functional (and secure)?

I realize Magento != Wordpress. It's so close to being as install-friendly as Wordpress. Just a little more!

like image 799
101010 Avatar asked Feb 11 '12 22:02

101010


People also ask

Can we run Magento on Windows?

Finally, Magento 2 is successfully installed and is ready to operate on Windows localhost. 1.3 Step 3: Download Magento 2.3. 5 setup from the Magento Official website. 1.7 Step 7: Run the Magento Composer Command to remove browser console error and resolve the broken image link.


2 Answers

I use the following script, and run it every now and then.

In the future, I'm going to add chown -R root.www-pub to the end of it, add all users that have to modify the code to a www-pub group, and set the umask to 0002. In the meantime, the below script works well.

#!/bin/bash

if [ ! -f ./app/etc/local.xml ]; then
    echo "-- ERROR"
    echo "-- This doesn't look like a Magento install.  Please make sure"
    echo "-- that you are running this from the Magento main doc root dir"
    exit
fi

if [ `id -u` != 0 ]; then
    echo "-- ERROR"
    echo "-- This script should be run as root so that file ownership"
    echo "-- changes can be set correctly"
    exit
fi

find . -type f \-exec chmod 644 {} \;
find . -type d \-exec chmod 755 {} \;
find ./var -type d \-exec chmod 777 {} \;
find ./var -type f \-exec chmod 666 {} \;
find ./media -type d \-exec chmod 777 {} \;
find ./media -type f \-exec chmod 666 {} \;
chmod 777 ./app/etc
chmod 644 ./app/etc/*.xml
like image 179
roberttstephens Avatar answered Sep 20 '22 22:09

roberttstephens


If you are on a development environment, this is the way to go:

chmod -R 777 /magento-directory/

Otherwise this should do:

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

The first line will find folders and chmod them to 755. The second find files and chmod them to 644.

More from a Magento wiki article.

like image 29
Zachary Schuessler Avatar answered Sep 19 '22 22:09

Zachary Schuessler