HOW TO RUN A CLAM AV MALWARE/VIRUS SCAN ON YOUR DEDICATED SERVER Print

  • 0

Running a malware/virus scan on your dedicated server is not hard nor complicated at all - though to scan efficiently on a dedicated server the process must be done logged in as root with an ssh connection.

Make sure in WHM clamav is up to date as can be ( WHM/cPanel always seem to lag behind a bit ) by checking in WHM --> Manage Plugins --> and that "Install and keep updated" is check marked.

To invoke the clam scan help menu:

/usr/local/cpanel/3rdparty/bin/clamscan --help


To scan everything in the home directory in one shot and have the found infections moved to a folder i.e. /root/infected/ ( the "infected" folder must be created prior to running the command )

/usr/local/cpanel/3rdparty/bin/clamscan -ir /home/ --exclude-dir='/home/virtfs|/home/.cpan|/home/.cpcpan' -l /var/log/clamscan.log --move=/root/infected


To scan everything in just the /public_html/ folders in one shot and have the found infections moved to a folder i.e. /root/infected/ ( the "infected" folder must be created prior to running the command )

/usr/local/cpanel/3rdparty/bin/clamscan -ir /home/*/public_html --exclude-dir='/home/virtfs|/home/.cpan|/home/.cpcpan' -l /var/log/clamscan.log --move=/root/infected


If you use scripts that expect ClamAV binaries in the /usr/local/bin directory, create symbolic links with the following commands:

ln -s /usr/local/cpanel/3rdparty/bin/clamscan /usr/local/bin/clamscan

ln -s /usr/local/cpanel/3rdparty/bin/freshclam /usr/local/bin/freshclam

Was this answer helpful?

« Back