From DreamHost
Jump to: navigation, search

ClamAV is an open source antivirus program designed for Unix-like systems. Dreamhost does not currently provide ClamAV on its servers.

ClamAV can be useful for filtering out emails that contain a virus. A guide to installing ClamAV with ClamAssassin at

ClamAV Installation

Log into SSH using your choice of SSH software, such as Putty. Enter in the following information.

mkdir ~/install_files
mkdir ~/packages
cd ~/install_files
tar xvzf clamav-0.97.3.tar.gz
cd clamav-0.97.3
./configure --prefix=$HOME/packages --disable-clamav
make install

After you have installed ClamAV, you will want to keep it up to date, so you will want to add a cron tab.

crontab -e

Once in the crontab editor, you will want to add this line (change <your username> to your actual name):

0 1 * * * /home/<your username>/packages/bin/freshclam

This is just to get ClamAV installed, to do more advanced installation, go here:


Once you have installed ClamAV and the crontab, you probably want scan files, and to do so, you can use the following PHP code (Change with your domain):

$files = array();
$files[] = '~/';
$files[] = '~/';
$files[] = '~/';

$fList = implode(' ',$files);

$opt = shell_exec("~/packages/bin/clamscan $fList");
$out = explode("\n",$opt);

	$infected = explode(": ",$out[$i]);
	if($infected[1] == 'OK')
		echo $files[$i].' is NOT infected!<br />';
		echo $files[$i].' is infected.<br />';