Here is a script I just threw together to email me a listing of setuid files. I saved this file in /etc/cron.daily and chmod +x the script.
This way I'll get daily emails telling me what files are setuid root.
Code:
#!/bin/sh
###################################################################
# Script Purpose: Find all executable files with setuid root #
# File Name: find_setuid_root.sh #
# Version: 0.1.0 #
# Script Date: 01-29-05 #
# Mod Date: #
###################################################################
##############################################################
# User set variables
##############################################################
EMAIL_ADDRESS="YOUR.EMAIL@DOMAIN.COM"
EMAIL_SUBJECT="Setuid root files for ${HOSTNAME}, `date '+%m%d%y'`"
##############################################################
# Script begins here
##############################################################
find / -perm +4000 -print -user root | mail -s "${EMAIL_SUBJECT}" ${EMAIL_ADDRESS}
exit 0
I hope this is useful to someone.
I found the
find command with needed options here:
http://www.iss.net/security_center/a...id/default.htm