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

2 thoughts on “Joomla permissions fix script

  1. sherwin

    i had to move a joomla site from a windows server to a linux server and the permissions were totally screwed up. i just used your find command from the script and it worked perfect. thanks!

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s