How To Configure ClamAV to Perform Weekly System Scans and Send Email Notifications on Cpanel Servers
Posted by vipin h, Last modified by vipin h on 14 May 2018 05:09:04 PM
This article will guide you through the installation of ClamAV on a VPS/Dedicated Server with cPanel installed. We will also configure a weekly scan on ourServer.
What is ClamAv?
The Clam AntiVirus Scanner (ClamAV) antivirus software searches your server for malicious programs. If the scanner identifies a potential security threat, it flags the file to allow you to take the appropriate action.
How To install ClamAV?
You can easily install ClamAV on a cPanel server via WHM's Manage Plugins interface (WHM >> Home >> cPanel >> Manage Plugins).
How To Update ClamAV’s signatures?
The ClamAv binaries reside in the /usr/local/cpanel/3rdparty/bin/ directory:
You can create symbolic links for these binaries to "/usr/local/bin" directory so that you don't want to mention the complete path to the binary file everytime you run it
Now, run the following command to update ClamAV’s signatures:
How To Configure a Weekly Scan?
Now, just copy paste the following script to a file called "clamavscan.sh" under "/opt/" directory.
The above script will scan the files under the "public_html" directory of all the cpanel accounts hosted on your server. Please do remember to replace "firstname.lastname@example.org" with the respective email address you want to receive the alerts to.
Finally, create a cron job to automate this scan on a Weekly basis.
Eg: To create a cron job that runs on every Sunday at 00:00, use the following entry:
That's it!. You are done.