Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 16
  1. #1
    Member
    Join Date
    Sep 2009
    Location
    Athens Greece
    Posts
    201

    Default clamav scan /home and move infected files

    how can i schedule a cron for clam av to scan /home in the morning and move the infected files to a specific directory?

  2. #2
    Member
    Join Date
    Sep 2009
    Location
    Athens Greece
    Posts
    201

    Default Re: clamav scan /home and move infected files

    i found some info on the net is it correct?centos are the boxes
    mkdir /tmp/virus
    clamscan -ri --move=/tmp/virus /home
    on etc/crontab
    for 3.11 in the morning should look like this
    11 3 * * * root mkdir /tmp/virus ; clamscan -ri --log=var/log/clamscan.log --move=/tmp/virus/
    correct?

  3. #3
    Member
    Join Date
    May 2006
    Posts
    8

    Default Re: clamav scan /home and move infected files

    11 3 * * * clamscan -ir /home -l /var/log/clamscan.log --move=/tmp/virus --scan-mail=no

    This should work, you may not need to scan mails, so less time to search

  4. #4
    Member
    Join Date
    Sep 2009
    Location
    Athens Greece
    Posts
    201

    Default Re: clamav scan /home and move infected files

    on etc/crontab i have this command
    11 3 * * * clamscan -ir /home -l /var/log/clamscan.log --move=/tmp/virus
    if i check /var/log/clamscan.log the file is empty
    if i run the command manually clamscan.log appears ok
    what can we wrong you think?

  5. #5
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,300
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: clamav scan /home and move infected files

    First of all, determine the path to clamscan:

    Code:
    whereis clamscan
    Then change to that path:

    Code:
    11 3 * * * /pathto/clamscan -ir /home -l /var/log/clamscan.log --move=/tmp/virus
    Here you would replace /pathto/clamscan with the output from the prior "whereis clamscan" command.

    Next, do you have the cron set to email you when it runs? If you do not, then in crontab -e or /var/spool/cron/root where you have the cron set, put the following above the entry:

    Code:
    MAILTO="email@mydomain.com"
    Please replace email@mydomain.com with your email address. This should cause an email to be sent whenever the cron runs. If there are any errors for the cron to process, you should get those via that email.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  6. #6
    cPanel, Inc. Staff
    Join Date
    Apr 2011
    Posts
    34

    Default Re: clamav scan /home and move infected files

    Hello,

    I would recommend using the following:

    11 3 * * * /usr/bin/clamscan -ir /home --exclude-dir='/home/virtfs|/home/.cpan|/home/.cpcpan' -l /var/log/clamscan.log --move=/tmp/virus

    This will prevent the virtfs and CPAN directories from being scanned.

    If you are using jailshell and do not exclude virtfs, you will get duplicate matches in your scan and some weird results with moving the files.
    Thank you,

    Jerry Smith
    Technical Analyst I
    cPanel Inc.

  7. #7
    Member
    Join Date
    Sep 2009
    Location
    Athens Greece
    Posts
    201

    Default Re: clamav scan /home and move infected files

    thanks for the update i correct the path and both of the commands appears to work
    Last edited by k-planethost; 05-18-2011 at 02:56 AM.

  8. #8
    Member
    Join Date
    Sep 2009
    Location
    Athens Greece
    Posts
    201

    Default Re: clamav scan /home and move infected files

    let me ask something else
    on cpanel documentation i found this
    for i in `awk '!/nobody/{print $2 | "sort | uniq" }' /etc/userdomains | sort | uniq`; do /usr/bin/clamscan -i -r /home/$i 2>>/dev/null; done >> /root/infections&

    if i want to store the infections on /tmp/virus the cron command at /var/spool/cron/root should be

    11 3 * * * for i in `awk '!/nobody/{print $2 | "sort | uniq" }' /etc/userdomains | sort | uniq`; do /usr/bin/clamscan -i -r /home/$i 2>>/dev/null; done >> /tmp/virus

    correct?

  9. #9
    Member
    Join Date
    Nov 2011
    Posts
    302
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: clamav scan /home and move infected files

    Quote Originally Posted by k-planethost View Post
    let me ask something else
    on cpanel documentation i found this
    for i in `awk '!/nobody/{print $2 | "sort | uniq" }' /etc/userdomains | sort | uniq`; do /usr/bin/clamscan -i -r /home/$i 2>>/dev/null; done >> /root/infections&

    if i want to store the infections on /tmp/virus the cron command at /var/spool/cron/root should be

    11 3 * * * for i in `awk '!/nobody/{print $2 | "sort | uniq" }' /etc/userdomains | sort | uniq`; do /usr/bin/clamscan -i -r /home/$i 2>>/dev/null; done >> /tmp/virus

    correct?
    In my view it should work but please ensure that /tmp is secured before you store viruses into it.

  10. #10
    Member
    Join Date
    Sep 2009
    Location
    Athens Greece
    Posts
    201

    Default Re: clamav scan /home and move infected files

    yes it is secured
    for i in `awk '!/nobody/{print $2 | "sort | uniq" }' /etc/userdomains | sort | uniq`; do /usr/local/bin/clamscan -i -r /home/$i 2>>/dev/null; done >> /tmp/virus
    this command from ssh result me this
    -bash: /tmp/virus: Is a directory

    also today i recompile from source the new version of clamav Since i use mailscanner i recompile always according to this
    Installing ClamAV with MailScanner
    well the core box takes ages to scan and i have errors like this
    LibClamAV Warning: [Bytecode JIT]: JITed code intercepted runtime error!
    LibClamAV Warning: Bytcode 37 failed to run: Error during bytecode execution
    LibClamAV Warning: [Bytecode JIT]: recovered from error
    LibClamAV Warning: [Bytecode JIT]: JITed code intercepted runtime error!
    LibClamAV Warning: [Bytecode JIT]: Bytecode run timed out, timeout flag set
    LibClamAV Warning: Bytcode 37 failed to run: Unknown error code
    LibClamAV Warning: [Bytecode JIT]: recovered from error
    LibClamAV Warning: [Bytecode JIT]: JITed code intercepted runtime error!
    LibClamAV Warning: Bytcode 37 failed to run: Error during bytecode execution

    on clamd.conf
    Bytecode yes
    BytecodeSecurity TrustSigned
    BytecodeTimeout 5000
    i try to increase and decrease the BytecodeTimeout 5000 but server still returns the same errors
    does anybody has any idea about this?

  11. #11
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,300
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: clamav scan /home and move infected files

    /tmp/virus will need to be a file rather than a folder for the command to function.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  12. #12
    Member
    Join Date
    Sep 2009
    Location
    Athens Greece
    Posts
    201

    Default Re: clamav scan /home and move infected files

    i correct it appears to work now

  13. #13
    Member
    Join Date
    Nov 2011
    Posts
    302
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: clamav scan /home and move infected files

    Quote Originally Posted by k-planethost View Post
    i correct it appears to work now
    Glad to know

  14. #14
    Member
    Join Date
    Sep 2009
    Location
    Athens Greece
    Posts
    201

    Default Re: clamav scan /home and move infected files

    LibClamAV Warning: [Bytecode JIT]: JITed code intercepted runtime error!
    LibClamAV Warning: Bytcode 37 failed to run: Error during bytecode execution
    LibClamAV Warning: [Bytecode JIT]: recovered from error
    LibClamAV Warning: [Bytecode JIT]: JITed code intercepted runtime error!
    LibClamAV Warning: [Bytecode JIT]: Bytecode run timed out, timeout flag set
    LibClamAV Warning: Bytcode 37 failed to run: Unknown error code
    LibClamAV Warning: [Bytecode JIT]: recovered from error
    LibClamAV Warning: [Bytecode JIT]: JITed code intercepted runtime error!
    LibClamAV Warning: Bytcode 37 failed to run: Error during bytecode execution

    this one i fix it the box is ok now something was wrong with the databases

    another one server withClamAV - v0.97.3 i still observe this

    LibClamAV Warning: cli_scanbzip: bzip2 support not compiled in
    LibClamAV Warning: cli_scanbzip: bzip2 support not compiled in

    i think clamscan misses some test files

    Package bzip2-1.0.3-6.el5_5.x86_64 is already installed and latest version
    do you think i have to recompile with --enable-bzip2 ?

    tar -xzf clamav-*
    cd clamav*
    ./configure --disable-zlib-vcheck --enable-bzip2
    make
    make install

    any suggestions should be usefull

  15. #15
    Member
    Join Date
    Nov 2011
    Posts
    302
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: clamav scan /home and move infected files

    Hi,

    Try running freshclam and see if that fixed the error.

Similar Threads & Tags
Similar threads

  1. clamav lets in massive number of infected files
    By ebizindia in forum E-mail Discussions
    Replies: 19
    Last Post: 10-25-2010, 05:00 PM
  2. How do I scan all accounts using ClamAV?
    By sharmaine001 in forum cPanel Developers
    Replies: 2
    Last Post: 04-07-2010, 11:24 AM
  3. How do I scan all accounts using ClamAV?
    By sharmaine001 in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 09-20-2009, 06:30 AM
  4. how i can scan all hdd with clamav?
    By robocap in forum cPanel Developers
    Replies: 10
    Last Post: 12-02-2006, 10:38 AM
  5. Checking for infected files.
    By 4402734 in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 09-25-2005, 07:57 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube