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 want to find files in some folder like /home/mike/www/test where only root has read permissions and not any other user.

EDIT: I have the sudo and permission but I want to list all files where only root has read permission but not any group or public?

share|improve this question

migrated from Aug 31 '12 at 7:13

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

Can you sudo to get root permissions? – Peter Gluck Aug 31 '12 at 0:59
i have sudo and root permissions – user1596900 Aug 31 '12 at 1:04
If a file has 0 permissions (or other weird settings like 333), then the owner cannot at the moment read those files (though the owner could change the permission so that they could read those files). Also, if a directory on the path leading to the file is not accessible (the x-bit) to the general world (e.g. the directory is owned by root with 700 permission), then ordinary files under that directory are not readable by others, regardless of who owns them or the permissions on the file. So, there are other possible interpretations for the question, but the selected answer is most plausible. – Jonathan Leffler Aug 31 '12 at 2:34
how can i get those files who have special permissions – user1596900 Aug 31 '12 at 3:31
up vote 5 down vote accepted
find /home/mike/www/test -user root -perm +400 ! -perm +044 -print
share|improve this answer
thanks buddy , u guys r great – user1596900 Aug 31 '12 at 1:28

You need to use the find command to determine just which directories and files are only readable by root. Something like this might do what you want:

sudo find / -uid 0 -perm 600

This will generate a list of all files owned by UID 0 (root) with only read permissions for root. The list will be absolute pathnames.

You can redirect the output to a file, or pipe it to another program.

Do man find for a comprehensive list of options supported.

share|improve this answer

Try using the sudo command to elevate your permissions.

sudo ls /home/mike/www/test


sudo find /home/mike/www/test -name "foo" -print

If you cannot do that you will need to have a system administrator add your login to the /etc/sudoers file.

share|improve this answer
i think u didn't understood my questions. I want to list all files in folders and under subfolders where only root has read permission but not any other user or group – user1596900 Aug 31 '12 at 1:04
Ah, yes, I did misunderstand the question. – Peter Gluck Aug 31 '12 at 1:30

You must log in to answer this question.