rlm@1: #!/bin/bash rlm@1: # Copyright (c) 2004 Matthias S. Benkmann
rlm@1: # You may do everything with this code except misrepresent its origin. rlm@1: # PROVIDED `AS IS' WITH ABSOLUTELY NO WARRANTY OF ANY KIND! rlm@1: rlm@1: if [ $# != 1 -o "$1" = "--help" ]; then rlm@1: echo 1>&2 rlm@1: echo 1>&2 'USAGE: '"${0##*/}"' ' rlm@1: echo 1>&2 rlm@1: echo 1>&2 ' Outputs a categorized list of files and directories with properties' rlm@1: echo 1>&2 ' that could mean trouble and should be investigated.' rlm@1: echo 1>&2 ' Suspicious objects will be reported only if group and/or user equals' rlm@1: echo 1>&2 ' (numeric UID/GID allowed).' rlm@1: echo 1>&2 ' This script calls `'"${0%_*}'"' for the real work.' rlm@1: echo 1>&2 rlm@1: exit 1 rlm@1: fi rlm@1: rlm@1: ugname="$1" rlm@1: rlm@1: ugmatcher=(-false) rlm@1: #test if find accepts ugname as a user, and append to ugmatcher if it does rlm@1: if find / -maxdepth 0 -user "$ugname" >/dev/null 2>&1 ; then rlm@1: ugmatcher[${#ugmatcher[@]}]="-or" rlm@1: ugmatcher[${#ugmatcher[@]}]="-user" rlm@1: ugmatcher[${#ugmatcher[@]}]="$ugname" rlm@1: fi rlm@1: #test if find accepts ugname as a group, and append to ugmatcher if it does rlm@1: if find / -maxdepth 0 -group "$ugname" >/dev/null 2>&1 ; then rlm@1: ugmatcher[${#ugmatcher[@]}]="-or" rlm@1: ugmatcher[${#ugmatcher[@]}]="-group" rlm@1: ugmatcher[${#ugmatcher[@]}]="$ugname" rlm@1: fi rlm@1: rlm@1: #if find accepted ugname as neither user nor group, then exit rlm@1: if [ "${#ugmatcher[@]}" = 1 ]; then rlm@1: echo 1>&2 'find does not accept `'"$ugname'"' as group or user name' rlm@1: exit 1 rlm@1: fi rlm@1: rlm@1: "${0%_*}" "${ugmatcher[@]}"