I want to write a shell script that will show me which users home directories are world readable so I can easily see directories I have access to. I was trying to figure out how to do this. If anyone could point me in the right direction it would be appreciated!
Asked
Active
Viewed 713 times
3 Answers
5
You can use find -perm
like this:
find /base/path -type d -perm +o+r
+o+r
will only list directories with word (others) read bit on.

anubhava
- 761,203
- 64
- 569
- 643
0
have you checked this
find /dir/to/search -type f -exec sh -c 'file -b {} | grep text &>/dev/null' \; -print

Community
- 1
- 1

Sunil Verma
- 2,490
- 1
- 14
- 15
-2
Use this command
ll /path/to/your/dirextory/ | grep ^d......r..
This will give you the directories will everyone has permission to read.
-
-1 `ll` is not a standard command, and parsing the output of `ls` is poor practice. – tripleee Sep 29 '13 at 07:53
-
@triplee, I agree that `ll` ia not a standard command, but `ls` is described in the POSIX specification, so don't see why parsing its output would be poor practice, as long as it is done correctly (which is not the case here) – Scrutinizer Sep 29 '13 at 09:09
-
1
-
@tripleee: Thanks for the link and pointing out that file names can contain newline characters! I have never come across a file name with newlines, so for command line work, one can probably get away with it, but for production shell scripts, that is a different matter, I agree.. – Scrutinizer Feb 11 '14 at 17:46