Clam AntiVirus is an open source (GPL) anti-virus toolkit for UNIX. It provides a number of utilities including a flexible and scalable multi-threaded daemon, a command line scanner and advanced tool for automatic database updates. Because ClamAV's main use is on file/mail servers for Windows desktops, it primarily detects Windows viruses and malware with its built-in signatures.
Install the clamav package.
ClamXAV keeps threats at bay and puts you firmly in charge of your Mac’s security. Scan a specific file or your entire hard drive. Set it to scan automatically or run. The main purpose of this software is the integration with mail servers (attachment scanning). The package provides a flexible and scalable multi-threaded daemon in the clamav-daemon package, a command-line scanner in the clamav package, and a tool for automatic updating via the Internet in the clamav-freshclam package. I have stopped and disabled the clamav-daemon and clamav-freshclam services. The following commands have been used to stop and disable them from running at bootime: service clamav-daemon stop; service clamav-freshclam stop; update-rc.d -f clamav-daemon remove; update-rc.d -f clamav-freshclam remove.
Update the virus definitions with:
If you are behind a proxy, edit
/etc/clamav/freshclam.conf and update HTTPProxyServer, HTTPProxyPort, HTTPProxyUsername and HTTPProxyPassword.
The database files are saved in:
clamav-freshclam.service so that the virus definitions are kept recent.
Starting the daemonNote:
- You will need to run
freshclambefore starting the service for the first time or you will run into trouble/errors which will prevent ClamAV from starting correctly.
- The daemon is not needed if you only want to perform stand-alone scans. See Scan for viruses below.
The service is called
clamav-daemon.service. Start it and enable it to start at boot.
Testing the software
Clamav Daemon Mac Os
In order to make sure ClamAV and the definitions are installed correctly, scan the EICAR test file (a harmless signature with no virus code) with clamscan.
The output must include:
Otherwise; read the Troubleshooting part or ask for help in the Arch Forums.
Adding more databases/signatures repositories
ClamAV can use databases/signature from other repositories or security vendors.
To add the most important ones in a single step, install either clamav-unofficial-sigsAUR (see GitHub description) or python-fangfrischAUR (see online documentation). Both will add signatures/databases from popular providers, e.g. MalwarePatrol, SecuriteInfo, Yara, Linux Malware Detect, etc.
clamav-freshclam.servicestarted in order to have official signature updates from ClamAV mirrors.
Option #1: Set up Fangfrisch
Fangfrisch was designed as a more secure, flexible and convenient replacement for clamav-unofficial-sigs, and requires very little configuration.
Most importantly, Fangfrisch never needs to be run with root permissions, unlike clamav-unofficial-sigs.
Create database structure by running:
Option #2: Set up clamav-unofficial-sigs
This will regularly update the unofficial signatures based on the configuration files in the directory
To update signatures manually, run the following:
To change any default settings, refer and modify
If you would like to use the MalwarePatrol database, sign up for an account at https://www.malwarepatrol.net/free-guard-upgrade-option.
/etc/clamav-unofficial-sigs/user.conf, change the following to enable this functionality:
Scan for viruses
There are two options for on-demand scanning:
using the stand-alone scanner
clamscan can be used to scan certain files, home directories, or an entire system:
If you would like
clamscan to remove the infected file add to the command the
--remove option, or you can use
--move=/dir to quarantine them.
You may also want
clamscan to scan larger files. In this case, append the options
--max-scansize=4000M to the command. '4000M' is the largest possible value, and may be lowered as necessary.
-l /path/to/file option will print the
clamscan logs to a text file for locating reported infections.
using the daemon
clamdscan is similar to the above but utilizes the daemon, which must be running for the command to work. Most options are ignored since the daemon reads the the settings specified in
Using the milter
Milter will scan your sendmail server for email containing virus.Adjust the config
/etc/clamav/clamav-milter.conf to your needs. For example:
Enable and start
Clamav Daemon Machina
For Postfix add the following lines to
Check journalctl if the permission to access clamav-milter.socket for postfix is set accordingly, if not, add user postfix to group clamav.
This article or section is out of date.
On-access scanning requires the kernel to be compiled with the fanotify kernel module (kernel >= 3.8). Check if fanotify has been enabled before enabling on-access scanning.
On-access scanning will scan the file while reading, writing or executing it.
First, edit the
/etc/clamav/clamd.conf configuration file by adding the following to the end of the file (you can also change the individual options):
Next, create the file
/etc/clamav/detected.sh and add the following. This allows you to change/specify the debug message when a virus has been detected by clamd's on-access scanning service:
If you are using AppArmor, it is also necessary to allow clamd to run as root:
Error: Clamd was NOT notified
If you get the following messages after running freshclam:
Add a sock file for ClamAV:
/etc/clamav/clamd.conf - uncomment this line:
Save the file and restart
Error: No supported database files found
Clamav Windows Download
If you get the next error when starting the daemon:
This happens because of mismatch between
/etc/clamav/freshclam.conf pointing to
/etc/clamav/clamd.conf (default directory) pointing to
/usr/share/clamav, or other directory. Edit in
/etc/clamav/clamd.conf and replace with the same DatabaseDirectory like in
/etc/clamav/freshclam.conf. After that clamav will start up successfully.
Clamav Download For Windows 10
Error: Can't create temporary directory
If you get the following error, along with a 'HINT' containing a UID and a GID number:
Tips and tricks
Run in multiple threads
When scanning a file or directory from command line using
clamscan only single CPU thread is used. This may be ok in cases when timing is not critical or you do not want computer to become sluggish. If there is a need to scan large folder or USB drive quickly you may want to use all available CPUs to speed up the process.
clamscan is designed to be single-threaded, so
xargs can be used to run the scan in parallel:
In this example the
-P parameter for
clamscan in as many processes as there are CPUs (reported by
nproc at the same time.
--max-args options will allow even finer control of batching the workload across the threads.
If you already have
clamd daemon running
clamdscan can be used instead (see #Starting the daemon):
--multiscan parameter enables
clamd to scan the contents of the directory in parallel using available threads.
--fdpass parameter is required to pass the file descriptor permissions to
clamd as the daemon is running under
clamav user and group.
The number of available threads for
clamdscan is determined in
MaxThreads parameter clamd.conf(5). Even though you may see that the number of
MaxThreads specified is more than one (current default is 10), when you start the scan using
clamdscan from command line and do not specify
--multiscan option, only one effective CPU thread will be used for scanning.
Clam AntiVirus (ClamAV) is a free and open source, cross platform antivirus toolkit able to detect many types of malicious software, including viruses. One of its main uses is on mail servers as a server-side email virus scanner. The application was developed for Unix and has third party versions available for AIX, BSD, HP-UX, Linux, OS X, OpenVMS, OSF (Tru64) and Solaris.
As of version 0.97.5, ClamAV builds and runs on Microsoft Windows. Both ClamAV and its updates are made available free of charge.
ClamAV is a powerful AntiVirus scanner focused towards integration with mail servers for attachment scanning. It provides a flexible and scalable multi-threaded daemon, a command line scanner, and a tool for automatic updating via the Internet.
Clam AntiVirus is based on a shared library distributed with the Clam AntiVirus package, which you can use with your own software. Most importantly, the virus database is kept up to date. The project was acquired by Sourcefire in 2007
ClamAV includes a number of utilities: a command-line scanner, automatic database updater and a scalable multi-threaded daemon, running on an anti-virus engine from a shared library.
The application also features a Milter interface for sendmail and on-demand scanning. It has support for Zip, RAR, Tar, Gzip, Bzip2, OLE2, Cabinet, CHM, BinHex, SIS formats, most mail file formats, ELF executables and Portable Executable (PE) files compressed with UPX, FSG, Petite, NsPack, wwpack32, MEW, Upack and obfuscated with SUE, Y0da Cryptor. It also supports many document formats, including Microsoft Office, HTML, Rich Text Format (RTF) and Portable Document Format (PDF).