Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

How can I find a file on my hard drive created by root that has write permissions?

share|improve this question

migrated from stackoverflow.com Jul 28 '11 at 21:32

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

You need to be more specific. Where are you looking for the file? Do you know any specifics about the file (name, type, etc)? – kevlar1818 Jul 28 '11 at 21:16
use the find command and the -perm switch. I don't get the title of your question... – Fredrik Pihl Jul 28 '11 at 21:16
yes ... may you give me a find command for it ... Tnx – Ejder Jul 28 '11 at 21:18
have you tried the answer below from @Jaidev-Sridhar ? – Fredrik Pihl Jul 28 '11 at 21:24
Sorry, but did you even bother to read man find? All the answers point you to that and that is for a reason. – rozcietrzewiacz Jul 29 '11 at 6:22

To look for a file matching multiple conditions with find, simply list each condition in turn. For example, to look for a file owned by root (-user root) and writable by its owner (-perm -u+w) on the root filesystem (-xdev, meaning not to recurse underneath mount points such as /proc and /sys) and called hello:

find / -xdev -user root -perm -u+w -name hello

If you're looking for world-writable files, replace -u+w by -a+w. (The - before the permissions means that the file must have at least these permissions; without it find would look for a file having exactly the specified permissions.) With GNU find, you can also look for a file that is writable by the user running find: replace -perm -u+w by -writable.

share|improve this answer
find / -uid 0 -perm u+w,g+w,o+w

If you want writable by others, just have o+w.

share|improve this answer
I created ex.pl previously and chmodded it to 777, and then executed your command, but the command didn't find ex.pl. What's wrong? – Ejder Jul 28 '11 at 21:34
You can condense u+w,g+w,o+w into a+w. But you need to tell find to look for a file having at least these permissions: -perm -a+w. – Gilles Jul 28 '11 at 22:18
@Ejder did you create the file as user root? – jman Jul 28 '11 at 22:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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