CLAMD(8)
๐ CLAMD(8) โ Clam Daemon, the anti-virus daemon ๐
okay so bestie, welcome to the Clam AntiVirus corner of the man pages ๐ธ this one is Clam Daemon (that's <clamd> to its friends), and it's genuinely iconic. grab a snack, we're going in ๐ซถ
โจ NAME โจ
clamd โ an anti-virus daemon ๐
โจ SYNOPSIS โจ
clamd [options]
โจ DESCRIPTION โจ
so the daemon listens for incoming connections on a Unix socket and/or a TCP socket and scans files or directories on demand. it's giving very attentive, very on-call โจ
and where does it get its whole personality? it reads the config from /etc/clamav/clamd.conf. that's the vibe source, periodt.
โจ COMMANDS โจ
๐ก the glow-up tip: it's recommended to prefixclamdcommands with the letterz(eg.zSCAN). why? because that tells clamd the command will be delimited by a NULL character, and that clamd should keep reading command data until a NULL character shows up. the null delimiter is what assures you that the complete command and its entire argument get processed as a single command. no half-sent chaos, we love to see it ๐
alternatively, commands may be prefixed with the letter n (e.g. nSCAN) to use a newline character as the delimiter. and clamd's replies will honour the terminator you asked for, in turn. reciprocal queen ๐
if clamd doesn't recognize the command, or the command doesn't follow the requirements below, it will reply with an error message, and close the connection. brutal but fair ๐
clamd recognizes the following commands:
PING
check the server's state. it should reply with "PONG". tiny, perfect, no notes ๐
VERSION
print program and database versions. this command may be disabled with EnableVersionCommand in clamd.conf. if it's disabled, clamd replies with COMMAND UNAVAILABLE.
RELOAD
reload the virus databases. this command may be disabled with EnableReloadCommand in clamd.conf. if it's disabled, clamd replies with COMMAND UNAVAILABLE.
SHUTDOWN
perform a clean exit. this command may be disabled with EnableShutdownCommand in clamd.conf. if it's disabled, clamd replies with COMMAND UNAVAILABLE.
SCAN file/directory
scan a file or a directory (recursively) with archive support enabled (unless that's disabled in clamd.conf). a full path is required โ no shortcuts bestie, give it the whole thing.
CONTSCAN file/directory
scan file or directory (recursively) with archive support enabled, and don't stop the scanning when a virus is found. it keeps going, resilient icon ๐ฆ
MULTISCAN file/directory
scan a directory recursively using multiple threads (to make the scanning faster on SMP machines). if the target is not a directory, clamd falls back to non-multiscan scanning behavior.
ALLMATCHSCAN file/directory
โ ๏ธ it is mandatory to prefix this command withnorz.
ALLMATCHSCAN works just like SCAN except that it sets a mode where scanning continues after finding a match within a file. this command may be disabled with AllowAllMatchScan in clamd.conf. if it's disabled, clamd replies with an ALLMATCHSCAN error.
INSTREAM
โ ๏ธ it is mandatory to prefix this command withnorz.
scan a stream of data. the stream is sent to clamd in chunks, after INSTREAM, on the same socket on which the command was sent. this avoids the overhead of establishing new TCP connections and problems with NAT, which is lowkey genius โจ
the format of the chunk is: '<length><data>' where <length> is the size of the following data in bytes, expressed as a 4 byte unsigned integer in network byte order, and <data> is the actual chunk. streaming is terminated by sending a zero-length chunk.
๐ note: do not exceedStreamMaxLengthas defined inclamd.conf, otherwise clamd will reply withINSTREAM size limit exceededand close the connection. respect the limit, babe.
FILDES
โ ๏ธ it is mandatory to newline terminate this command, or prefix withnorz.
this command only works on UNIX domain sockets. scan a file descriptor. after issuing a FILDES command, a subsequent rfc2292/bsd4.4 style packet (with at least one dummy character) is sent to clamd carrying the file descriptor to be scanned inside the ancillary data. alternatively the file descriptor may be sent in the same packet, including the extra character.
STATS
โ ๏ธ it is mandatory to newline terminate this command, or prefix withnorz, and it is recommended to only use thezprefix.
replies with statistics about the scan queue, contents of scan queue, and memory usage. the exact reply format is subject to change in future releases. this command may be disabled with EnableStatsCommand in clamd.conf. if it's disabled, clamd replies with COMMAND UNAVAILABLE.
IDSESSION, END
โ ๏ธ it is mandatory to prefix this command withnorz, and all commands insideIDSESSIONmust be prefixed.
start/end a clamd session. within a session, multiple SCAN, INSTREAM, FILDES, VERSION, VERSIONCOMMANDS, PING, and STATS commands can be sent on the same socket without opening new connections. but CONTSCAN, MULTISCAN, ALLMATCHSCAN, RELOAD, and SHUTDOWN are not accepted inside an IDSESSION. house rules ๐ซ
replies from clamd will be in the form '<id>: <response>' where <id> is the request number (in ascii, starting from 1) and <response> is the usual clamd reply. the reply lines have the same delimiter as the corresponding command had. clamd will process the commands asynchronously, and reply as soon as it has finished processing.
clamd requires clients to read all the replies it sent, before sending more commands, to prevent send() deadlocks. the recommended way to implement a client that uses IDSESSION is with non-blocking sockets, and a select()/poll() loop: whenever send would block, sleep in select/poll until either you can write more data, or read more replies. note that using non-blocking sockets without the select/poll loop and alternating recv()/send() doesn't comply with clamd's requirements. do it properly, i'm begging ๐
if clamd detects that a client has deadlocked, it will close the connection. note that clamd may close an IDSESSION connection too if you don't follow the protocol's requirements. the client can use the PING command to keep the connection alive. friendship maintenance, basically ๐
VERSIONCOMMANDS
โ ๏ธ it is mandatory to prefix this command with eithernorz. it is recommended to usenVERSIONCOMMANDS.
print program and database versions, followed by "| COMMANDS:" and a space-delimited list of supported commands. Clamd <0.95 will recognize this as the VERSION command, and reply only with their version, without the commands list.
this command can be used as an easy way to check for IDSESSION support, for example. handy bestie behaviour ๐ฅ
๐๏ธ REMOVED COMMANDS ๐
STREAM
the legacy STREAM command is no longer supported. use INSTREAM instead. she's retired, let her rest ๐
๐ซ NOT SUPPORTED COMMANDS ๐ซ
SESSION, END
start/end a clamd session which will allow you to run multiple commands per TCP session. (use IDSESSION instead) it's giving old news, sorry babe ๐ญ
โจ OPTIONS โจ
-h,--helpโ output help information and exit.-V,--versionโ print the version number and exit.-F,--foregroundโ run in foreground; do not daemonize.--debugโ enable debug mode.-c FILE,--config-file=FILEโ read configuration from FILE.--fail-if-cvd-older-than=daysโ return with a nonzero error code if the virus database is older than the specified number of days.--datadir=DIRECTORYโ load signatures from DIRECTORY.-p FILE,--pid=FILEโ write the daemon's pid to FILE.--cvdcertsdir=DIRโ specify a directory containing the root CA cert needed to verify detached CVD digital signatures. if not provided, then clamd will look in the default directory.
โจ ENVIRONMENT VARIABLES โจ
clamd uses the following environment variables:
LD_LIBRARY_PATHโ may be used on startup to find thelibclamunrar_ifaceshared library module to enable RAR archive support. ๐ฆCVD_CERTS_DIRโ specify a directory containing the root CA cert needed to verify detached CVD digital signatures. if not provided, then clamd will look in the default directory.
โจ SIGNALS โจ
clamd recognizes the following signals:
SIGHUPโ reopen the logfile.SIGUSR2โ reload the signature databases.SIGTERMโ perform a clean exit.
โจ FILES โจ
/etc/clamav/clamd.conf
โจ CREDITS โจ
please check the full documentation for credits. (they really said "the credits are in the full docs", and honestly? valid ๐)
โจ AUTHOR โจ
Tomasz Kojm <tkojm@clamav.net> ๐
โจ SEE ALSO โจ
clamd.conf(5), clamdscan(1), freshclam(1), freshclam.conf(5), clamav-milter(8)
and that's the whole page, bestie ๐ this was ClamAV 1.5.4, dated February 12, 2009 โ yeah she's an elder but she still ate, no cap. go forth and scan responsibly, mwah ๐๐โจ
๐ฆ where this page comes from
- arch rolling: clamav 1.5.4-1 ยท GPL-2.0-only
- nixpkgs unstable: clamav 1.5.4
- ubuntu jammy: clamav-daemon 1.5.4+dfsg-0ubuntu0.22.04.1 ยท GPL-2.0-only
- ubuntu noble: clamav-daemon 1.5.4+dfsg-0ubuntu0.24.04.1 ยท GPL-2.0-only
- ubuntu resolute: clamav-daemon 1.5.4+dfsg-0ubuntu0.26.04.1 ยท GPL-2.0-only
- ubuntu stonking: clamav-daemon 1.5.4+dfsg-0ubuntu1 ยท GPL-2.0-only
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms