The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

set up cron for chkrootkit

Discussion in 'Security' started by thelunatic, Jun 11, 2011.

  1. thelunatic

    thelunatic Registered

    Joined:
    Dec 2, 2007
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Australia
    hi,
    can have help with crontab to run weekly:)
     
  2. kbob

    kbob Member

    Joined:
    May 30, 2011
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    @Thelunatic

    The necessary cron for weekly run is :

    This will run each Sunday as per instructed, of course you can always change the name of the script if your bash file is elsewhere and it probably is.

    Hope this helps you in any way.
     
  3. system1351

    system1351 Member

    Joined:
    May 17, 2010
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    World Wide Web
    cPanel Access Level:
    Root Administrator
    Hi man...

    i create this script.... i still a few hours to make that.. i am not find that in any site (the combination ha)

    you change cron.daily to weekly
    nano /etc/cron.daily/rkhunter.sh

    then in rkhunter.sh put this code:

    #!/bin/bash
    (/usr/local/bin/rkhunter --checkversion
    /usr/local/bin/rkhunter --update
    /usr/local/bin/rkhunter -c -sk
    /usr/local/bin/rkhunter --cronjob --report-warnings-only) | mail -s "Server XXX Weekly Report" support@yourdomain.com


    then run this (change daily for weekly)
    chmod +x /etc/cron.daily/rkhunter.sh

    then make a test (change daily for weekly)
    :)
    sh /etc/cron.daily/rkhunter.sh
     
  4. k-planethost

    k-planethost Well-Known Member

    Joined:
    Sep 22, 2009
    Messages:
    199
    Likes Received:
    4
    Trophy Points:
    18
    Location:
    Athens Greece
  5. k2tec

    k2tec Well-Known Member

    Joined:
    Aug 26, 2011
    Messages:
    81
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    Netherlands
    cPanel Access Level:
    Root Administrator
    I also tried to setup a cronjob for Chkrootkit-0.49
    When I run it manualy it run okay cd /root/chkrootkit-0.49 ==> ./chkrootkit

    I Made the cronjob in /etc/cron.daily

    #!/bin/bash
    cd /root/chkrootkit-0.49/
    ./chkrootkit | mail -s "chkrootkit Scan." host@myserver.com

    but I become this message
    /etc/cron.daily/chkrootkit.sh:

    /etc/cron.daily/chkrootkit.sh: line 3: mail: command not found

    Is there someone with a answer.

    Tom
     
  6. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Change to the path for mail instead:

    Code:
    ./chkrootkit | /bin/mail -s "chkrootkit Scan" host@myserver.com
     
  7. k2tec

    k2tec Well-Known Member

    Joined:
    Aug 26, 2011
    Messages:
    81
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    Netherlands
    cPanel Access Level:
    Root Administrator
    I changed it to
    Code:
    ./chkrootkit | /bin/mail -s "chkrootkit Scan" host@myserver.com
    but tested with:
    Code:
     sh  /etc/cron.daily/chkrootkit.sh
    gave me
    Code:
    /etc/cron.daily/chkrootkit.sh: line 3: /bin/mail: No such file or directory
    Code:
    # whereis mail
    mail: /etc/mail
    but in the mail directory is only spamassassin
     
  8. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    When I do "whereis mail", I show the following:

    Code:
    root@host [~]# whereis mail
    mail: /bin/mail /etc/mail.rc /etc/mail /usr/lib/mail.tildehelp /usr/lib/mail.help /usr/share/man/man1/mail.1.gz
    Run this command to see the output:

    Code:
    rpm -qa | grep -i mailx
    If you show the rpm, then remove it:

    Code:
    rpm -e --nodeps mailx
    Now, reinstall it:

    Code:
    yum -y install mailx
    After that, check if /bin/mail now exists:

    Code:
    ls -lah /bin/mail
     
  9. k2tec

    k2tec Well-Known Member

    Joined:
    Aug 26, 2011
    Messages:
    81
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    Netherlands
    cPanel Access Level:
    Root Administrator
    shows
    lrwxrwxrwx 1 root root 5 Aug 29 18:48 /bin/mail -> mailx

    whereis mail shows

    Code:
    mail: /bin/mail /etc/mail /etc/mail.rc /usr/share/man/man1/mail.1.gz
    I will look tomorrow if its run these night correct.

    Thanks,
    Tom
     
  10. k2tec

    k2tec Well-Known Member

    Joined:
    Aug 26, 2011
    Messages:
    81
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    Netherlands
    cPanel Access Level:
    Root Administrator
  11. phicts

    phicts Active Member

    Joined:
    Feb 8, 2013
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    Does the tutorial here also work in WHM 11.34 with Centos 6.3 64-bit?

    I'm having the same issue as K2tec and would like to try the pointers given by cPanelTristan but i'm kinda wary of messing up my vps.

    Thanks in advance.
     
  12. k2tec

    k2tec Well-Known Member

    Joined:
    Aug 26, 2011
    Messages:
    81
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    Netherlands
    cPanel Access Level:
    Root Administrator
    If you follow cPanelTristan
    it will work I am running centos 6.3 64 bit and WHM 11.34
     
  13. phicts

    phicts Active Member

    Joined:
    Feb 8, 2013
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    Yes, I just did. I found out that mailx was not installed but it's OK now.
    Thanks.
     
Loading...

Share This Page