How to run ClamAV scan from SSH in cPanel server?

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 plugin available for cPanel servers. If ClamAV plugin is installed in WHM server, individual cPanel users can also scan their home directory, emails, FTP directory from cPanel itself.

 

  1. Login to your Linux machine via SSH.

  2. Run the following command to scan specific cPanel user's public_html directory. Make sure you replace actual cPanel username with "username" in 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 scan is finished, you will be given Scan Summary report with list of infected files if any.

  3. To scan the public_html directory of all cPanel accounts, issue following command.

    clamscan -ri /home/*/public_html
  4. To run the clamscan command to all cPanel accounts, issue following command.

    clamscan -ri /home
  5. Issue following command to run the clamscan to remove infected files while scanning public_html directory of all cPanel accounts.

    clamscan -ri –remove /home/*/public_html

Related Articles

How to check PHP and Apache Modules that are Installed on a Linux?

Following are the steps to check which PHP and Apache Modules are installed on Linux. Login via...

How To install Nginx on CentOS 7?

Nginx is a Web server that can be installed on Linux Server. You may have heard about Apache Web...

How do I connect to Linux VPS through SSH from Linux and Windows OS?

This article will guide you on how to login to Linux VPS through SSH (Secure Shell) from Linux...

How To Install Postfix on Ubuntu 18.04?

Postfix is an open-source Mail Transfer Agent (MTA). It uses to route and deliver emails on a...

How to install ISPConfig on Debian 10?

ISPConfig is an Open-source Hosting Control Panel for Linux. It is used widely as it is free of...

  • 0 Users Found This Useful

Was this answer helpful?