1

I'm on Debian 9.5 and have the following /etc/cronjob.weekly/rkhunter file :

#!/bin/sh

OUTPUT=`rkhunter --cronjob --report-warnings-only`

if [ "$OUTPUT" != "" ]
then
    echo $OUTPUT | mail -s "[rkhunter] Warnings found for $(hostname)" root@youremail
fi

Of couse, I have changed the mail with my real one.

When I execute sudo /etc/cronjob.weekly/rkhunter to test it, it doesn't work. Could you help me to have this cron work?

EDIT to clarify: I have set a cronjob to have Rkhunter send me weekly reports on my mail address. To test it, I can execute directly sudo /etc/cronjob.weekly/rkhunter and it will execute the cronjob and send me the mail. However, when I execute the command, it doesn't send me the mail, so I guess something is wrong in the file.

cyclone200
  • 125
  • 4

1 Answers1

1

Open an sh shell and type which rkhunter and which echo and which mail to see where your programs actually are.

Then in your script, change the words 'rkhunter' 'echo' and 'mail' to the output of the three commands respectively.

CubeSyVal
  • 31
  • 3