Samba + Clamd + Samba-Vscan On CentOS 5.2

This is a howto on getting samba + clamav + samba-vscan to work on a CentOS 5.2 system.

1. First let's start by getting clamav installed and functioning.

You can either compile it yourself or use yum to install this via a repo. For this we will create a repo named dag.repo in /etc/yum.repos.d/. Add the following....

name=Dag RPM Repository for Red Hat Enterprise Linux

2. Install clamd and configure clamd:

yum install clamd.i386

vi /etc/clamd.conf

and change the socket to /var/run/clamav/clamd.sock.

3. Update clamd by running freshclam:


4. If you are going through a proxy you can set this up by editing the file /etc/freshclam.conf.

5. Run

chkconfig clamd on

6. Run

service clamd start

7. Create a directory for quarantine. For example:

mkdir /virus

8. Perform a scan of shares and move infections to quarantine.

clamdscan --move=/virus/ /pathtoshares

9. Now we need to install the source code for samba.

10. Verify the current samba version that you have.

rpm -q samba

11. Get the source code for the version of samba that you are running. This can be done with wget.


12. Install via

rpm -ihv samba-3.0.28-1.el5_2.1.src.rpm

13. Extract the samba tar file in /usr/src/redhat/SOURCES:

cd /usr/src/redhat/SOURCES
tar xzvf samba-3-0.28.tar.gz

14. Run ./configure  and make proto in the samba source directory.

cd /usr/src/redhat/SOURCES/samba-3.0.28/sources
make proto

15. Get samba vscan release 0.3.6cBeta5 if you are using samba3.0.25 or later.


16. Extract the samba-vscan tarball.

tar xzvf samba-vscan-0.3.6c-beta5.tar.gz

17. Go to that directory.

cd /usr/src/redhat/SOURCES/samba-3.0.28/examples/VFS/samba-vscan-0.3.6c-beta5/

18. Make the backend for clamav:    

make clamav

19. Copy the    

cp /usr/lib/samba/vfs/

20. Copy the vscan conf file to the samba dir.    

cp clamav/vscan-clamav.conf /etc/samba/

21. Edit /etc/samba/vscan-clamav.conf to your liking making sure that the clamd socket = /var/run/clamav/clamd.sock:

vi /etc/samba/vscan-clamav.conf

vfs object = vscan-clamav  vscan-clamav: config-file = /etc/samba/vscan-clamav.conf 

22. If everything works out, you should probably exclude samba from updating via the nightly yum. To do this just add


to your /etc/yum.conf file.

Bo Lynch

Share this page:

4 Comment(s)

Add comment


From: Davide at: 2008-11-29 08:36:23

samba-vscan is an outdated software, the latest upgrade is at 2005!! there's an alternative?

From: Girish KG at: 2008-12-27 07:30:35

name=Dag RPM Repository for Red Hat Enterprise Linux

From: at: 2010-07-22 11:35:28


I have problems with this tutorial .. I'm using version 5.5 and samba samba-3.0.33-3.29.el5_5.src.rpm investment of version 0.28.

First, he accuses descompatação error in the package .. informing

Warning: The user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root

Then, in step 17. Go to That directory.

cd / usr/src/redhat/SOURCES/samba-3.0.33/examples/VFS/samba-vscan-0.3.6c-beta5 /

-Bash: cd: / usr/src/redhat/SOURCES/samba-3.0.33/examples/VFS/samba-vscan-0.3.6c-beta5 /: File or directory not found river

make clamav

Then, in step 1. Make the backend for clamav:

make clamav

Could you help me ..



From: at: 2008-12-29 19:19:35

What about packages from ?

I remember reading that the packages have the vscan compiled in them.