ClamAV (简体中文)

From ArchWiki
Revision as of 10:01, 22 October 2012 by Inzuiqiang (talk | contribs) (Created page with "Category:Daemons and system services(简体中文) Category:Security en:ClamAV es:ClamAV it:ClamAV ru:ClamAV sr:ClamAV [ Clam ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.


ClamAV can be installed with package clamav, available in the Official Repositories.


Whether you are going to use clamav as a daemon or use it as a simple file checker you need to comment out the line that contains the word Example, usually it is found at the beginning of /etc/clamav/freshclam.conf and /etc/clamav/clamd.conf files.

Starting the daemon

If you want to use the daemon, you can start it with:

# rc.d start clamav

To start it automatically at boot add clamav to the DAEMONS array in /etc/rc.conf. Also in /etc/conf.d/clamav change the start options from "no" to "yes".

# change these to "yes" to start



# freshclam




clamscan 可用以扫描文件, 用户目录或实体系统:

$ clamscan myfile
$ clamscan -r -i /home
$ clamscan -r -i --exclude-dir=^/sys\|^/proc\|^/dev /

If you would like clamscan to remove the infected file use the --remove option in the command.


If you get the following messages after running freshclam:

WARNING: Clamd was NOT notified: Cannot connect to clamd through 
/var/lib/clamav/clamd.sock connect(): No such file or directory

Add a sock file for clamav:

# touch /var/lib/clamav/clamd.sock
# chown clamav:clamav /var/lib/clamav/clamd.sock

Then, edit /etc/clamav/clamd.conf – uncomment this line:

LocalSocket /var/lib/clamav/clamd.sock

Save the file and restart the daemon (rc.d stop clamav; rc.d start clamav)

If you get the next error when starting the daemon:

LibClamAV Error: cli_loaddb(): No supported database files found
in /var/lib/clamav ERROR: Not supported data format

Run freshclam as root:

# freshclam -v

If you get a:

# can't create temporary directory

error, along with a 'HINT' containing a UID and a GID number.

Do the following:

# chown UID:GID /var/lib/clamav & chmod 755 /var/lib/clamav 
# ex: chown 64:64