Overview
Clam AntiVirus is a free software, cross-platform antimalware toolkit able to detect many types of malware, including viruses.
Install ClamAV
ClamAV can be installed from the apps page. To go to the apps page, click on Install an App under Apps in the admin panel.
Admin Panel Screenshot
Enduser Panel Screenshot
Scan Entire Home Directory — Scans your server’s home directory.
Scan Mail — Scans all of your server’s mail folders.
Scan Public FTP Space — Scans all folders that FTP users can access.
Scan Public Web Space — Scans all folders that web visitors can access.
ClamAV cron job
After you configure ClamAV, we recommend that you schedule a root
cron job to run daily during off-peak hours. The following example demonstrates a command that will scan the server’s accounts:
find /home/ -mindepth 1 -maxdepth 1 -type d ! -user root -exec /usr/bin/clamscan -i -r {} \; > /root/scan_results.txt
You can set cpu limit to a certain percentage for clamscan process.
Note: Make sure you have cpulimit installed in your OS.
To install cpulimit, run the below command:
For Ubuntu:
apt-get install cpulimit
For Centos/Almalinux:
yum install cpulimit
Note: Clamav requires cpu resources for scanning. If you decrease the cpu limit of clamscan, it will take more time to finish the scanning.
After installing cpulimit, you can set the cronjob for clamscan with cpulimit.
For example, the below command sets the cpulimit of clamscan process to 80%:
cpulimit -l 80 -e clamscan & id=$!; find /home/ -mindepth 1 -maxdepth 1 -type d ! -user root -exec /usr/bin/clamscan -i -r {} \; > /root/scan_results.txt; kill $id