Page 1 of 2 1 2 LastLast
Results 1 to 10 of 17

Thread: Linux Run Rkhunter And Send Reports Via Email ( Cronjob )

  1. #1
    Junior Member
    Join Date
    May 2010
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default Linux Run Rkhunter And Send Reports Via Email ( Cronjob )

    Hello I just installed and run automatically Rkhunter gives me this message may pro please help

    /etc/cron.daily/rkhunter.sh:

    Null message body; hope that's ok

    My file rkhunter.sh


    #!/bin/bash
    /usr/local/bin/rkhunter --cronjob 2>&1 | mail -s RKhunter_Scan_Details my_email


    Thanks

  2. #2
    Contributors jaysunn's Avatar
    Join Date
    Apr 2009
    Location
    NYC - USA
    Posts
    1,029
    Thanks
    165
    Thanked 154 Times in 133 Posts
    Rep Power
    24

    Default

    This this:


    Code:
    #!/bin/bash
    /usr/local/bin/rkhunter --cronjob 2>&1 | mail -s my_email < RKhunter_Scan_Details
    You need to redirect the email message into the mail command.

    Use this template:

    Code:
    #!/bin/bash
    # script to send simple email
    # email subject
    SUBJECT="SET-EMAIL-SUBJECT"
    # Email To ?
    EMAIL="admin@somewhere.com"
    # Email text/message
    EMAILMESSAGE="/tmp/emailmessage.txt"
    echo "This is an email message test"> $EMAILMESSAGE
    echo "This is email text" >>$EMAILMESSAGE
    # send an email using /bin/mail
    /bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE
    HTH,

    jaysunn

  3. #3
    Junior Member
    Join Date
    May 2010
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default Error Rkhunter

    Hi thanks for responding not understand the problem I create another bash?

  4. #4
    Never say die nixcraft's Avatar
    Join Date
    Jan 2005
    Location
    BIOS
    Posts
    4,515
    Thanks
    17
    Thanked 815 Times in 511 Posts
    Rep Power
    10

    Default

    Null message body; hope that's ok
    It means /usr/local/bin/rkhunter --cronjob did not produced any output so email body is empty. RKhunter_Scan_Details must be generated by rkhunter command. What is the output of the following?
    Code:
    /usr/local/bin/rkhunter --cronjob
    All [Solved] threads are closed by mods / admin to avoid spam issues. See Howto mark a thread as [Solved]


  5. #5
    Junior Member
    Join Date
    May 2010
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default Error Rkhunter

    Thanks

    Nothing comes

    root@server[~]# /usr/local/bin/rkhunter --cronjob
    root@server [~]#

  6. #6
    Never say die nixcraft's Avatar
    Join Date
    Jan 2005
    Location
    BIOS
    Posts
    4,515
    Thanks
    17
    Thanked 815 Times in 511 Posts
    Rep Power
    10

    Default

    Strange, how about check all options:
    Code:
     /usr/local/bin/rkhunter -c
    Now you should get some output
    All [Solved] threads are closed by mods / admin to avoid spam issues. See Howto mark a thread as [Solved]


  7. #7
    Junior Member
    Join Date
    May 2010
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default Error Rkhunter

    Thanks

    root@server [~]# /usr/local/bin/rkhunter -c
    [ Rootkit Hunter version 1.3.6 ]

    Checking system commands...

    Performing 'strings' command checks
    Checking 'strings' command [ OK ]

    Performing 'shared libraries' checks
    Checking for preloading variables [ None found ]
    Checking for preloaded libraries [ None found ]
    Checking LD_LIBRARY_PATH variable [ Not found ]

    Performing file properties checks
    Checking for prerequisites [ Warning ]
    /bin/awk [ OK ]
    /bin/basename [ OK ]
    /bin/bash [ OK ]
    /bin/cat [ OK ]
    /bin/chmod [ OK ]
    /bin/chown [ OK ]
    /bin/cp [ OK ]
    /bin/cut [ OK ]
    /bin/date [ OK ]
    /bin/df [ OK ]
    /bin/dmesg [ OK ]
    /bin/echo [ OK ]
    /bin/ed [ OK ]
    /bin/egrep [ OK ]
    /bin/env [ OK ]
    /bin/fgrep [ OK ]
    /bin/grep [ OK ]
    /bin/kill [ OK ]
    /bin/logger [ OK ]
    /bin/login [ OK ]
    /bin/ls [ OK ]
    /bin/mail [ OK ]
    /bin/mktemp [ OK ]
    /bin/more [ OK ]
    /bin/mount [ OK ]
    /bin/mv [ OK ]
    /bin/netstat [ OK ]
    /bin/passwd [ OK ]
    /bin/ps [ OK ]
    /bin/pwd [ OK ]
    /bin/rpm [ OK ]
    /bin/sed [ OK ]
    /bin/sh [ OK ]
    /bin/sort [ OK ]
    /bin/su [ OK ]
    /bin/touch [ OK ]
    /bin/uname [ OK ]
    /bin/gawk [ OK ]
    /usr/bin/awk [ OK ]
    /usr/bin/chattr [ OK ]
    /usr/bin/curl [ OK ]
    /usr/bin/cut [ OK ]
    /usr/bin/diff [ OK ]
    /usr/bin/dirname [ OK ]
    /usr/bin/du [ OK ]
    /usr/bin/env [ OK ]
    /usr/bin/file [ OK ]
    /usr/bin/find [ OK ]
    /usr/bin/groups [ Warning ]
    /usr/bin/head [ OK ]
    /usr/bin/id [ OK ]
    /usr/bin/kill [ OK ]
    /usr/bin/killall [ OK ]
    /usr/bin/last [ OK ]
    /usr/bin/lastlog [ OK ]
    /usr/bin/ldd [ Warning ]
    /usr/bin/less [ OK ]
    /usr/bin/locate [ OK ]
    /usr/bin/logger [ OK ]
    /usr/bin/lsattr [ OK ]
    /usr/bin/lynx [ OK ]
    /usr/bin/md5sum [ OK ]
    /usr/bin/newgrp [ OK ]
    /usr/bin/passwd [ OK ]
    /usr/bin/perl [ OK ]
    /usr/bin/pgrep [ OK ]
    /usr/bin/pstree [ OK ]
    /usr/bin/readlink [ OK ]
    /usr/bin/runcon [ OK ]
    /usr/bin/sha1sum [ OK ]
    /usr/bin/sha224sum [ OK ]
    /usr/bin/sha256sum [ OK ]
    /usr/bin/sha384sum [ OK ]
    /usr/bin/sha512sum [ OK ]
    /usr/bin/size [ OK ]
    /usr/bin/stat [ OK ]
    /usr/bin/strace [ OK ]
    /usr/bin/strings [ OK ]
    /usr/bin/sudo [ OK ]
    /usr/bin/tail [ OK ]
    /usr/bin/test [ OK ]
    /usr/bin/top [ OK ]
    /usr/bin/tr [ OK ]
    /usr/bin/uniq [ OK ]
    /usr/bin/users [ OK ]
    /usr/bin/vmstat [ OK ]
    /usr/bin/w [ OK ]
    /usr/bin/watch [ OK ]
    /usr/bin/wc [ OK ]
    /usr/bin/wget [ Warning ]
    /usr/bin/whatis [ Warning ]
    /usr/bin/whereis [ OK ]
    /usr/bin/which [ OK ]
    /usr/bin/who [ OK ]
    /usr/bin/whoami [ OK ]
    /usr/bin/gawk [ OK ]
    /sbin/chkconfig [ OK ]
    /sbin/depmod [ OK ]
    /sbin/fuser [ OK ]
    /sbin/ifconfig [ OK ]
    /sbin/ifdown [ Warning ]
    /sbin/ifup [ Warning ]
    /sbin/init [ OK ]
    /sbin/insmod [ OK ]
    /sbin/ip [ OK ]
    /sbin/kudzu [ OK ]
    /sbin/lsmod [ OK ]
    /sbin/modinfo [ OK ]
    /sbin/modprobe [ OK ]
    /sbin/nologin [ OK ]
    /sbin/rmmod [ OK ]
    /sbin/runlevel [ OK ]
    /sbin/sulogin [ OK ]
    /sbin/sysctl [ OK ]
    /sbin/syslogd [ OK ]
    /usr/sbin/adduser [ OK ]
    /usr/sbin/chroot [ OK ]
    /usr/sbin/groupadd [ OK ]
    /usr/sbin/groupdel [ OK ]
    /usr/sbin/groupmod [ OK ]
    /usr/sbin/grpck [ OK ]
    /usr/sbin/kudzu [ OK ]
    /usr/sbin/lsof [ OK ]
    /usr/sbin/prelink [ OK ]
    /usr/sbin/pwck [ OK ]
    /usr/sbin/sestatus [ OK ]
    /usr/sbin/tcpd [ OK ]
    /usr/sbin/useradd [ OK ]
    /usr/sbin/userdel [ OK ]
    /usr/sbin/usermod [ OK ]
    /usr/sbin/vipw [ OK ]
    /usr/local/bin/perl [ OK ]
    /usr/local/bin/rkhunter [ OK ]
    /usr/local/bin/sudo [ OK ]
    /etc/rkhunter.conf [ OK ]

    [Press <ENTER> to continue]

  8. #8
    Never say die nixcraft's Avatar
    Join Date
    Jan 2005
    Location
    BIOS
    Posts
    4,515
    Thanks
    17
    Thanked 815 Times in 511 Posts
    Rep Power
    10

    Default

    It is working, I think script should be as follows:

    Code:
    #!/bin/bash
    /usr/local/bin/rkhunter --cronjob 2>&1 /tmp/RKhunter_Scan_Details | mail -s my_email < /tmp/RKhunter_Scan_Details
    If there is any outpuy you will get message with the output else you will get an empty message.
    All [Solved] threads are closed by mods / admin to avoid spam issues. See Howto mark a thread as [Solved]


  9. #9
    Junior Member
    Join Date
    May 2010
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default Error Rkhunter

    Thanks to execute I have this error

    rkhunter.sh: line 2: /tmp/RKhunter_Scan_Details: No such file or directory

  10. #10
    Contributors jaysunn's Avatar
    Join Date
    Apr 2009
    Location
    NYC - USA
    Posts
    1,029
    Thanks
    165
    Thanked 154 Times in 133 Posts
    Rep Power
    24

    Default

    Maybe stderr & stdout out needs to be redirected to file /tmp/RKhunter_Scan_Details:

    See Red >
    Code:
    #!/bin/bash
    /usr/local/bin/rkhunter --cronjob 2>&1 > /tmp/RKhunter_Scan_Details | mail -s my_email < /tmp/RKhunter_Scan_Details
    Vivek,

    What what do you think?

    jaysunn

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Exim4 - Limit daily send email
    By flipmode in forum Mail Servers
    Replies: 2
    Last Post: 7th May 2010, 07:41 PM
  2. Send Email To User When Some Path Is getting Low
    By jaysunn in forum Getting started tutorials
    Replies: 3
    Last Post: 30th August 2009, 07:46 AM
  3. BASH Script To Send Email When Something Fails in The system
    By hudipirlo in forum Shell scripting
    Replies: 1
    Last Post: 17th April 2009, 10:40 AM
  4. how to send email on every saturday in perl
    By chandanperl in forum Coding in General
    Replies: 4
    Last Post: 22nd August 2008, 07:25 PM
  5. A script for generating cPanel backup and send as email
    By vivekv in forum Shell scripting
    Replies: 0
    Last Post: 20th October 2007, 09:28 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •