Skip to content
Home » Blog » Automatically CHMOD various file type

Automatically CHMOD various file type

Several sites have been harmed due to improper permissions. This interesting hack gives the site a semi-auto healing mechanism.
Warning: Your mileage may vary.
{code type=PHP}
#Ensure CHMOD settings for specified file types
# remember to never set CHMOD 777 unless you know what you are doing
# files requiring write access should use 766 rahter than 777
# keep specific file types private by setting their chmod to 400
chmod .htpasswd files 640
chmod .htaccess files 644
chmod php files 600
{/code}

Leave a Reply

Your email address will not be published. Required fields are marked *