TIME NOW
World current time now,
CALENDAR
Calendar monthly, yearly
login CONVERT LENGTH
login CONVERT TEMPERATURE
login DICTIONARIES, LISTS
login SCIENCE EDUCATION RELIGION
login WORK CALCULATOR
login CALCULATE LIFE

Linux commands, scripts, examples, tutorial

Previous articlePage bottomNext article  ALL TOPICS

Linux. Web site protection: Joomla security

 I think, that best protection of web sites is from Linux OS side.
This is script example to lock and unlock permissions. Unlock is partial. Principles are common for all web sites. I unlock manually, and lock via CRON service (you can use on terminal logout). Folders are related to CMS Joomla:

#!/bin/sh

folder1='/var_www/pro_com'
folder2='/var_www/main/en'
folder3='/var_www/main/lt'
folder4='/var_www/main/pl'
folder5='/var_www/main/ru'

folderList=" $folder1 $folder2 $folder3 $folder4 $folder5"
folderChild=" administrator _common* components modules templates plugins configuration.php index.php _files _gallery *installation* cli* libraries includes"
folderChildNoRecursive=" images images/* "

if [ ! $1 ]
then

chmod 750  /var_www/*  2>/dev/null ; chown root:root/var_www/*  2>/dev/null

# recursive changes

for fParent in $folderList
    do

    chown root:root $fParent
    chmod 755 $fParent

        for fChild in $folderChild
            do

                fCommon="$fParent/$fChild"

                /bin/chown -R root:root $fCommon 2>/dev/null
                sleep 1

                # echo $fCommon unallow

                /bin/chmod -R 755 $fCommon 2>/dev/null

            done
    done

for fParent in $folderList
    do

    chown wwwLock:www $fParent
    chmod 755 $fParent

        for fChild in $folderChildNoRecursive
            do

                fCommon="$fParent/$fChild"

                /bin/chown wwwLock:www $fCommon 2>/dev/null
                sleep 1

                # echo $fCommon unallow

                /bin/chmod  755 $fCommon 2>/dev/null

            done
    done

# Exceptions

/bin/chown -R www:www $folder1/_common_/_media $folder1/components/com_tarocards/tmp_img
/bin/chmod -R 777 $folder1/_common_/_media $folder1/components/com_tarocards

# Strict rules

/bin/chmod -R 700 /_scr/psw* /_scr/_c* /_scr

/bin/chmod 700 /_backups /_backups/*

/bin/chmod 700 /_mysql /_mysql/* /_soft

############################################################## ELSE

else

for fParent in $folderList
    do

        for fChild in $folderChild
            do

                fCommon="$fParent/$fChild"

                /bin/chown -R www:www $fCommon 2>/dev/null
                sleep 1

                #echo $fCommon

                /bin/chmod -R 777 $fCommon 2>/dev/null

            done
    done

fi

exit 0

 
Previous articlePage topNext article  ALL TOPICS



 Use username: Guest, Anonymous, Programmer






QUOTES:
Forgive, son; men are men; they needs must err.
Euripides
It is not easy for men to rise whose qualities are thwarted by poverty.
Juvenal
T.J. got called up from Richmond. I'm very happy for him.
Tony Pena