Coder Perfect

When a permission isn’t set, use ‘find -perm’ to find out.

Problem

I’m looking for the files in my directory that aren’t viewable (eg the files with g-r). So here’s what I did:

-perm -g-r find

It displays all of the files to me? So here’s what I did:

-perm -g+r find

And it only showed me the files that were viewable. -perm -g-r appears to work for all files. CentOS 5.5 is the operating system I’m running. Is there something I’m missing? It doesn’t appear that -perm -g-r is of any benefit.

Asked by User1

Solution #1

Try:

-perm -g+r -perm -g+r -perm -perm -perm -perm

Answered by jgr

Solution #2

You could use this to locate files that you are unable to read.

find . ! -readable

Answered by Charley

Solution #3

Because you were running it as root, you were able to see all files when you ran the following command.

find . -perm -g-r

Try running the command as a regular user.

Answered by seenshee91

Post is based on https://stackoverflow.com/questions/4382599/using-find-perm-to-find-when-a-permission-is-not-set