 

 [    ](https://www.facebook.com/sharer/sharer.php?u=https://www.skvare.com/markdownify/node/92&title=Daily%20emails%20from%20chkrootkit%20using%20postfix%20/%20sendmail%20command "Share to Facebook") [    ](https://www.linkedin.com/sharing/share-offsite/?url=https://www.skvare.com/markdownify/node/92 "Share to Linkedin") [    ](mailto:?subject=Daily%20emails%20from%20chkrootkit%20using%20postfix%20/%20sendmail%20command&body=https://www.skvare.com/markdownify/node/92 "Share to Email") 

 

 

#  Daily emails from chkrootkit using postfix / sendmail command 

 

 

 You have installed chkrootkit and it's now running with daily cron, but unless you are logging in daily to check the logs, you won't know of any potential problems. Here's a simple way to have the daily report emailed to you with only postfix installed, using the sendmail command.

Edit /etc/chkrootkit.conf and add the following

REPORT\_EMAIL="email@domain.com"

Edit /etc/cron.daily/chkrootkit and towards the bottom of the file, replace $CHKROOTKIT $RUN\_DAILY\_OPTS with

```

$CHKROOTKIT > $LOG_DIR/chkrootkit.log #Run chkrootkit and save the logfile
(
echo "Subject: [chkrootkit] $(hostname -f) - Daily report" #Create subject line using the hostname
echo "To: $REPORT_EMAIL" #Insert To: delivery email address using the variable defined in chkrootkit.conf
echo ""
cat $LOG_DIR/chkrootkit.log #Concat the logfile to the output
) | /usr/sbin/sendmail $REPORT_EMAIL #Send out the email!

```

It is probably a good idea to rotate the logs, so head over to /etc/logrotate.d/chkroot (new file) and enter

```

/var/log/chkrootkit/*.log {
  daily
  rotate 15
  dateext
  delaycompress
  missingok
  notifempty
}
```

Now wait for your daily scheduled cron to run, or run /etc/cron.daily/chkrootkit as root to test it out.