Find all .php files inside directories with 777 permissions

pleshy picture pleshy · Jun 28, 2012 · Viewed 10.3k times · Source

I have recently had a linux server compromised from bots uploading .php scripts and posing as images. I'm currently in the process of fixing this.

Because my server has a lot of websites I'm looking for a linux command to scan through all the 777 directories on the server and show ones with .php files inside them.

You can use the following command to return all 777 directories but this is not

find httpdocs/ -type d -perm 777

Any ideas?

Answer

Aleks G picture Aleks G · Jun 28, 2012

Try something like this:

find httpdocs/ -type d -perm 777 -exec find {} -name "*.php" \; 

This will show you all .php files in directories with 777 permissions. May not be ideal, but will get you started.