ClamAV + samba
This is a howto on getting samba + clamav to work on a rpm system
First thing first I need do install samba file server and clamav anti-virus, after configurating my samba share i have made 2 directory’s in /home
- virus
- logs
the virus folder contains the infected files found during scanning and the logs folder contains the report of the scanning witch is send bu email to you.
and added a script in crontab in the root account.
#!/bin/bash
TIME=$(date '+%Y-%m-%d-%T')
/usr/bin/clamdscan --move /home/virus/quarantine -v /home/samba > /home/logs/samba/dailyscan.$TIME
virus=`cat /home/logs/samba/dailyscan.$TIME | grep "Infected files" | awk '{print $3}'`
virus=`cat /home/logs/samba/dailyscan.$TIME | grep "Total errors:" | awk '{print $3}'`
if [ "$virus" != "0" ]; then
mail -u root -s "Virus on Samba File Server : Hostname `hostname`" you@mail.com </home/logs/samba/dailyscan.$TIME
else if [ "$error" != "0" ]; then
mail -u root -s "Error on virus scan Interliner.eu: Hostname `hostname`" you@mail.com </home/logs/samba/dailyscan.$TIME
fi
fi
and set the script to run once a day, in my case in 11:00pm, because the businesses it is not in the hours
. The reson is that i made it run once a day because it task’s 2 hours to finish the scanning, You can change this