clamAV installed, but not working on the command line and appears to not be installed

On new cPanel versions If you try to install ClamAV and face problems when trying to run on your server.I tell you , the problem is more easier to fix than you think.

root@host [~]# clamscan -ri /home/*/public_html/
-bash: clamscan: command not found

In cPanel the ClamAV executables are set up in /usr/local/cpanel/3rdparty/bin/. Traditionally symlinks have been designed in /usr/local/bin to help use on the command line. As of 11.40, new ClamAV set ups do not create symlinks in /usr/local/bin. If the symlinks are existing the set up snacks the operation as an “upgrade”, and re-creates them to the path of the set up.

If you are having this issue, and have already set up ClamAV through WHM, examine to ensure that your executables are here:

ls -lah /usr/local/cpanel/3rdparty/bin/*clam*

Clam scan1

If they are available make sure that there are no current ClamAV files in /usr/local/bin:

ls -l /usr/local/bin/*clam*

Clam scan-2

If both of above check out, you can create symlinks in /usr/local/bin to make scanning your server easier.

ln -s /usr/local/cpanel/3rdparty/bin/freshclam /usr/local/bin/freshclam
ln -s /usr/local/cpanel/3rdparty/bin/clamscan /usr/local/bin/clamscan
ln -s /usr/local/cpanel/3rdparty/bin/clamd /usr/local/bin/clamd
ln -s /usr/local/cpanel/3rdparty/bin/clamav-config /usr/local/bin/clamav-config

Then you can scan your server’s.

1) How to run clamscan to particular user account in cpanel server ?

Use the below command to run the clamscan for specofic user account. Change your username according to that.You will be got the output smiler like below. After completing the scan:

/usr/local/cpanel/3rdparty/bin/clamscan -ri /home/applecar/public_html

You can Verify the infected files if any and remove them.

clamscan-3

Note: Understanding clamAV command:

-r: To check files Recursively.
-i: To show only Infected files.

2) How to run clamscan to all account in cpanel server ?

Use the below commad to run the clam-scan for all user account. I’m going to run the scan to all user account on server. You will be got the output smillar like below. After completing the scan:

/usr/local/cpanel/3rdparty/bin/clamscan -ri /home

Again Verify the infected files and remove it.

3) How to run clamscan to public_html directory for all account in cpanel server ?

Use the below method to run the clamscan to public_html directory for all account in cpanel server

# /usr/local/cpanel/3rdparty/bin/clamscan -ri /home/*/public_html

4) How to remove infected file while scanning itself ?

Use the below method to run the clam-scan to remove infected file while scanning itself.

# /usr/local/cpanel/3rdparty/bin/clamscan -ri --remove /home/*/public_html

That’s all to do  now you know how to run scan on new cPanel versions.

You may also like to know how to Install ClamAV on your server . So, do check it out.

Give your opinion below if you experience any issues or to discuss your ideas and experiences.