Joomla Permissions Settings


Permissions Settings are the central problem with all CMS. Here is how I set permissions while installing extensions in Joomla.

Before and after installing an extension, I use these BASH scripts to change permissions so that nothing hangs. (it almost always does without using these)

Optional security tip: If it is possible in your environment, stopping Apache during the install provides a little bit of extra security, since you are opening up the site to potential hacks by setting permission to 777.

create a file called install-joomla.sh
#!/bin/bash
# script to open site for installing extensions
echo "DO NOT FORGET TO RESET PERMISSIONS AFTER INSTALL"
DOMAIN=$1
chown -R -f www-data:www-data /var/www/$DOMAIN
find /var/www/$DOMAIN -type d -exec chmod 777 {} \;
find /var/www/$DOMAIN -type f -exec chmod 777 {} \;

create a file called close-joomla.sh
#!/bin/bash
# script to close site after installing extensions
echo "That's better! Secure Again!"
DOMAIN=$1
chown -R -f www-data:www-data /var/www/$DOMAIN
find /var/www/$DOMAIN -type d -exec chmod 755 {} \;
find /var/www/$DOMAIN -type f -exec chmod 644 {} \;
find /var/www/$DOMAIN -name 'index.php' -exec chmod 440 {} \;
chmod -R 440 /var/www/$DOMAIN/configuration.php

Usage

sudo ~/close-joomla.sh www.example.com

If you are new to Joomla and/or you found this lifesaver, please Google+ or linkback even better Thanks!