[root@localhost ~]# vi chkrootkit ← 建立chkrootkit自动运行脚本
#!/bin/bash
PATH=/usr/bin:/bin
TMPLOG=`mktemp`
# Run the chkrootkit /usr/local/chkrootkit/chkrootkit > $TMPLOG
# Output the log cat $TMPLOG | logger -t chkrootkit
# bindshe of SMTPSllHow to do some wrongs if [ ! -z "$(grep 465 $TMPLOG)" ] && \ [ -z $(/usr/sbin/lsof -i:465|grep bindshell) ]; then sed -i '/465/d' $TMPLOG fi
# If the rootkit have been found,mail root [ ! -z "$(grep INFECTED $TMPLOG)" ] && \ grep INFECTED $TMPLOG | mail -s "chkrootkit report in `hostname`" root rm -f $TMPLOG
[root@localhost ~]# chmod 700 chkrootkit ← 赋予脚本可被执行的权限
[root@localhost ~]# mv chkrootkit /etc/cron.daily/ ← 将脚本移动到每天自动运行的目录中
|