At first, I wanted to simply use:

find /etc -type f -perm -004 

And it did work. But then there were two files from which a current user could not read, but a group this user was in could access it anyway. So it didn't work properly.

I think this problem is solvable by writing a small script and iterating over each group. But is there a simpler way around it?



find /etc -type f -readable

From man find:


Matches files which are readable. This takes into account access control lists and other permissions artifacts which the -perm test ignores. This test makes use of the access(2) system call, and so can be fooled by NFS servers which do UID mapping (or root-squashing), since many systems implement access(2) in the client's kernel and so cannot make use of the UID mapping information held on the server.

Limitation: This won't find readable files if they are under a directory that is not readable. (Hat tip roaima.)

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.