Listing 1. Search Script

#!/bin/sh
# A small script which finds all setuid and setgid
# programs.
# remove the old one if its present.
if [ -e ~/setuid_gid.progs ]; then
 rm -f ~/setuid_gid.progs
fi
# find the setuid and setgid files and make sure
# we can tell the difference between the list.
echo "--- setuid ---" >> ~/setuid_gid.progs
find / -perm -4000 | tee -a ~/setuid_gid.progs
echo "--- setgid ---" >> ~/setuid_gid.progs
find / -perm -2000 | tee -a ~/setuid_gid.progs