Linux Commands – File and Folder Permissions

I regularly find myself dealing with websites that have been hacked and they almost always have weak permissions. Here are the 2 commands I cant live without:

find . -type d -exec chmod 755 {} ;
find . -type f -exec chmod 644 {} ;

How to remove .php files recursively from the directory you are currently in.
WARNING: If you run this in your document root you will delete your entire site. Make sure you know where you are use pwd first to check your path is correct!

find . -name '*.php' -type f -exec rm -f {} ;

Leave a Reply

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