ClamWin

Advanced Operation

This section has details for more advanced users.

Modifying ClamWin's Default Configuration

If a copy of clamwin.conf is in the ClamWin executable files directory ("C:\Program Files\ClamWin\bin" on a default installation), then the first time a user runs ClamWin, it will use the contents of this file as the default configuration.

If you are to set up several new user accounts on a computer, or if you have just installed ClamWin on a system with multiple users, it is recommended that you set up a default configuration and copy the clamwin.conf file to this location.

Running a Virus Scan from the Command Line

ClamWin can be run from the command line, from a batch file for instance. For a full list of parameters, navigate to the directory containing the executable files ("C:\Program Files\ClamWin\bin" on a default installation) and run

clamscan.exe --help

The database directory must be specified, using the --database=FILE/DIR parameter. In a default installation, the command to scan the entire C: drive would be:

clamscan.exe --database="C:\Program Files\ClamWin\db" --recursive C:\

Note the use of the --recursive parameter to ensure that sub-directories are scanned.

When run from the command line, a value will be returned, indicating whether or not a virus was detected. If no virus is found, the return value will be 0. If a virus is found, the return value is 1. Any other return value indicates an error.

Updating the Virus Database from the Command Line

ClamWin uses freshclam.exe to update the virus database. As with the clamscan.exe scanning program, this can be run from a command line, batch file, etc. For a full list of parameters, navigate to the directory containing the executable files ("C:\Program Files\ClamWin\bin" on a default installation) and run

freshclam.exe –help

Both the database directory and the configuration file must be specified. ClamWin generates a freshclam configuration file on the fly, so you will have to create your own. The configuration file is a text file. See the ClamAV documentation for full details of what can be included. A simple freshclam configuration file would have the following lines (lines beginning with a # are comments):

# URL of server where database updates are to be downloaded from
# If this option is given multiple times, each will be tried in
# the order given until an update is successfully downloaded

DatabaseMirror database.clamav.net

# Number of times to try each mirror before moving to the next one

MaxAttempts 3



Once a freshclam configuration file has been created, freshclam can be run with a command similar to the one below:

freshclam --datadir="C:\Documents and Settings\All Users\.clamwin\db" --config-file="C:\Program Files\ClamWin\bin\freshclam.conf"

Getting Updates from a Local Server

If you have ClamWin running on several networked computers, you may wish to have a single computer downloading updates from the Internet, with the others getting updates over the local network. This can be done in the following way:

Set up a web server that has the main.cvd and daily.cvd files in the web root directory. It should be possible to download these files to the client pc's by pointing a webbrowser at http://YOURSERVERNAME/main.cvd and http://YOURSERVERNAME/daily.cvd.

In ClamWin's Internet Updates configuration tab on the clients, enter the web server's IP address or domain name in the Download Site text box. Do not include anything other than the IP address or domain name (eg 192.168.1.1 is correct, http://192.168.1.1/ is wrong). ClamWin will then query the local web server for updates, instead of a remote Internet server.

The files are available from www.clamav.net. You can create a batch script that automatically downloads these files to the root of your webserver using a tool such as wget, like :

wget http://%DB_MIRROR%/main.cvd -O "%WEBROOT%\main.cvd"

wget http://%DB_MIRROR%/daily.cvd -O "%WEBROOT%\daily.cvd"



Note that differential updates are currently impossible. You would have to mirror database.clamav.net, which is not supported for private use.



Manually Updating the Virus Database

To update the virus database manually, download the virus database files main.cvd and daily.cvd and copy them to ClamWin's virus database folder, over-writing the existing files. The virus database files can be downloaded from ClamAV's home page at www.clamav.net