#!/bin/sh
# find-setuid
SUIDFILES=/etc/sfiles
TEMPFILE=/tmp/$0.$$
find / -type f -a \( -perm 2000 -o -perm 4000 \) -print > $TEMPFILE

if [ ! -f $SUIDFILES ]; then
	echo "$0: creating list of SUID/SGID files in $SUIDFILES"
	mv $TEMPFILE $SUIDFILES
	chmod 400 $SUIDFILES
else
	echo "$0: differences between current and past SUID/SGID files:"
	diff $TEMPFILE $SUIDFILES
fi
