Blogs, Photo Albums, Comments, Pages just for Friends, Family, Fans...

And the Newest Feature:

"Graffiti Book"
One of the easiest ways to preserve your memories...

And Print Them Too!

ClamAV Email Checking on a Shared Host
2008-08-13 09:33:13
Return to Tech Notes

Article originally from:


This guide is designed for users who have a shared hosting account (no root access), namely on DreamHost. We will make use of ClamAV, procmail, and ClamAssassin.

Note: If you add a ~/.procmailrc file to DreamHost, you will likely be unable to use the DreamHost Control Panel’s Junk Filtering. Therefore, it is recommended that you check out this excellent SpamAssassin guide and the Dreamhost wiki. Note that I have installed everything in a ~/packages folder, which the previously mentioned guide does not do, so you should adjust accordingly. I also installed a more recent version of SpamAssassin than the previous guide (3.1.8 vs 3.1.0).

Install ClamAV

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

The –disable-clamav flag allows the package to be installed without a special user for clamav.

Modify Your Environment Variables

In your ~/.bash_profile, add the

export PATH="$HOME/packages/bin:$PATH"

At the console enter:

source ~/.bash_profile

Set up ClamAV

In ~/packages/etc/clamd.conf, comment out the line “Example”.
In ~/packages/etc/freshclam.conf, comment out the line “Example”.

Install ClamAssassin

ClamAssassin is a wrapper for ClamAV for use in procmail.

cd ~/install_files
tar xvzf clamassassin-1.2.4.tar.gz
cd clamassassin-1.2.4
./configure --prefix=$HOME/packages --disable-clamdscan --enable-subject-rewrite
make install

The –disable-clamdscan flag forces ClamAssassin to use clamscan rather than clamd (you don’t have to open any ports for a daemon). The –enable-subject-rewrite[=message] flag prepends an alert[=message] to the subject line of the email.

Add an entry to ~/.procmailrc to call ClamAssassin and move the email if a virus is found

# Scan for virii with clamassassin
| $HOME/packages/bin/clamassassin

# Send virus email to special folder
* ^X-Virus-Status: Yes

Update ClamAV

Update with FreshClam in your crontab

crontab -e

Add this line, to update the virus definitions at 1 AM everyday:

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


Send an email to yourself, you should see the X-Virus-Status header (view all the headers). On thunderbird, go to View > Headers > All.
You should see

(Optional) Clean up the install dir

cd ~/install_files
rm -rf *


[1] - Installing ClamAV with a non-root account
[2] - ClamAssassin Documentation