Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking for a Linux command to go through all the directories on my server and find all files with 777 permission. The output would be a list of all those files with full path.

share|improve this question

migrated from stackoverflow.com Nov 16 '09 at 3:19

This question came from our site for professional and enthusiast programmers.

Just like your last question, use find:

find / -type f -perm 0777
share|improve this answer

And if you like to find all files without Permission 0777 then just enter a ! before the perm, e.g.

find / -type f ! -perm 0777

share|improve this answer

You can also change the permissions or ownership of all those files resulting from the find execution using the -exec option to avoid change them manually. Exempli gratia: In a web server you could need to grant the group to write files:

find / -type f -perm 0777 -exec chmod 775 {} \; -exec chgrp -R www {} \;
share|improve this answer

it's as easy as:

find / -perm 0777

if you only want to match files, use this instead:

find / -type f -perm 0777
share|improve this answer

You must log in to answer this question.