In this article, we'll discuss how to run ClamAV scan via SSH in cPanel/WHM server. ClamAV is one of the most popular anti-virus plugins available for cPanel servers. If the ClamAV plugin is installed in the WHM server, individual cPanel users can also scan their home directory, emails, and FTP directory from cPanel.
1. Log in to your Linux machine via SSH.
2. Run the following command to scan the specific cPanel user's public_html directory. Make sure you replace the actual cPanel username with "username" in the following command. This command is useful when the specific cPanel account is infected and you want it to scan.
clamscan -ri /home/username/public_html
The flag -r denotes recursive file checking.
The flag -i will show only infected files.
Once the scan is finished, you will be given the Scan Summary report with the list of infected files, if any.
3. To scan the public_html directory of all cPanel accounts, issue the following command.
clamscan -ri /home/*/public_html
4. To run the clamscan command to all cPanel accounts, issue the following command.
clamscan -ri /home
5. Issue the following command to run the clamscan to remove infected files while scanning the public_html directory of all cPanel accounts.
clamscan -ri –remove /home/*/public_html