I'm looking for a linux command to scan through all writable directories on the server and show ones with .php and .html files inside them.

Something like:

find -type d -writable -exec find {} -iname '*.php' -o -iname '*.html' \;


migrated from serverfault.com Oct 16 '15 at 22:03

This question came from our site for system and network administrators.

  • What does writable mean? User, Group, All? – Trefex Oct 16 '15 at 22:45
  • 1
    writable by All – Deian Oct 17 '15 at 7:37

Use find and uniq together with sudo:

find / -type f -iname '*.php' -execdir sudo -u #UID -- bash -c 'test -w ./ && pwd' ';' |uniq

Replace UID with a non-existent user id, so test -w will only get true from all write permission.


Simply replace the -writable by -perm

find -type d -perm -a=w  -exec find {} -iname '*.php' -o -iname '*.html' \;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.