Category Archives: Joomla

Joomla permissions fix script

As I’m doing quite some Joomla development, I wrote this small script that could be used for multiple purposes. It takes 1 parameter which is the directory of your joomla installation (I restrained it within the “/var/www/” directory, as a precaution, but you can get rid of this) and  then goes through folders and files to change their permissions. Hope it’s useful to someone :


#! /bin/bash
# This script simply fixes the permissions on a Joomla install to be perfectly $
# Need at least 1 parameter, which is the joomla root directory
MINPARAMS=1
DIRECTORYPARAM=$1

if [ ${DIRECTORYPARAM:0:9} == "/var/www/" ];
then
if [ $DIRECTORYPARAM == "/var/www/" ];
then
echo "The directory CANNOT be /var/www/ itself"
else
find $DIRECTORYPARAM -type d -exec chmod 755 {} ;
find $DIRECTORYPARAM -type f -exec chmod 644 {} ;
fi
else
echo "The directory can ONLY be in /var/www/"
fi