2 # Copyright (c) 2004 Matthias S. Benkmann <article AT winterdrache DOT de>
3 # You may do everything with this code except misrepresent its origin.
4 # PROVIDED `AS IS' WITH ABSOLUTELY NO WARRANTY OF ANY KIND!
6 if [ $# != 1 -o "$1" = "--help" ]; then
8 echo 1>&2 'USAGE: '"${0##*/}"' <user_or_group>'
10 echo 1>&2 ' Outputs a categorized list of files and directories with properties'
11 echo 1>&2 ' that could mean trouble and should be investigated.'
12 echo 1>&2 ' Suspicious objects will be reported only if group and/or user equals'
13 echo 1>&2 ' <user_or_group> (numeric UID/GID allowed).'
14 echo 1>&2 ' This script calls `'"${0%_*}'"' for the real work.'
22 # test if find accepts ugname as a user, and append to ugmatcher if it does
23 if find / -maxdepth 0 -user "$ugname" >/dev/null 2>&1 ; then
24 ugmatcher[${#ugmatcher[@]}]="-or"
25 ugmatcher[${#ugmatcher[@]}]="-user"
26 ugmatcher[${#ugmatcher[@]}]="$ugname"
28 # test if find accepts ugname as a group, and append to ugmatcher if it does
29 if find / -maxdepth 0 -group "$ugname" >/dev/null 2>&1 ; then
30 ugmatcher[${#ugmatcher[@]}]="-or"
31 ugmatcher[${#ugmatcher[@]}]="-group"
32 ugmatcher[${#ugmatcher[@]}]="$ugname"
35 # if find accepted ugname as neither user nor group, then exit
36 if [ "${#ugmatcher[@]}" = 1 ]; then
37 echo 1>&2 'find does not accept `'"$ugname'"' as group or user name'
41 "${0%_*}" "${ugmatcher[@]}"