[Samba] configure dual samba 3.0.8 instances-one fedora box

birger birger at birger.sh
Thu Dec 9 08:52:51 GMT 2004

I did this yesterday, and don't have time for testing it yet, so I'll 
let you do the testing :-)

This is for Fedora Core 3, running samba 3.0.9-2 from the yum develop 
repository. Other builds may have stuff in other places.

First of all you will need a new IP address. This can be done on the 
existing network interface. On redhat/fedora you can use 
redhat-config-network or system-config-network as a gui for this. If you 
currently use eth0, set up a new address on eth0:1.

Then we have to make sure you existing domain leaves this IP address 
alone. And you have to decide which samba instance gets to own the 
loopback interface. I think I saw a note somewhere that swat cannot be 
used unless you bind to loopback, so only one domain may be able to use 
In /etc/samba/smb.conf (your existing instance), add
  interfaces = lo <IP of eth0>/24
  bind interfaces only = yes

Remove lo if this instance is not the one that should own loopback.

I guess you should restart this samba instance here and see that it only 
responds to the expected IP address(es) afterwards.

Then we start with the next instance.

Lets start in /etc/init.d
copy smb to smb-dom2
In smb-dom2:
  change all references to /var/run/samba, /etc/samba, 
/etc/sysconfig/samba (change samba to samba-dom2)
  change all references to /var/lock/subsys/smb (change smb to smb-dom2)
  add argument to all 'daemon' lines so they look like this:
    daemon --check=samba-dom2/smbd smbd $SMBDOPTIONS
    daemon --check=samba-dom2/nmbd nmbd $NMBDOPTIONS
  change all killproc lines by prepending samba-dom2/ to the first 
argument. e.g.
    killproc samba-dom2/smbd
  similarly change all status lines

If you need winbind on the domain, do something similar to the winbind 
startup file.

Now, copy /etc/sysconfig/samba to /etc/sysconfig/samba-dom2
Edit the file and add -s /etc/samba-dom2/smb.conf -l /var/log/samba-dom2 
to all 3 variables.

You may want to create the various directories at this point. 
/var/run/samba-dom2, /var/cache/samba-dom2 and /var/log/samba-dom2.

Now, set up /etc/samba-dom2/smb.conf
Change or add the following settings:
log file = /var/log/samba-dom2/%m.log
include = /etc/samba-dom2/smb.conf.%m
interfaces = <IP if eth0:1>/24
bind interfaces only = yes
pid directory = /var/run/samba-dom2
private dir = /etc/samba-dom2
lock directory = /var/cache/samba-dom2

Any other references to files or directories must also be reviewed. E.g. 
if you use a username map, change it to
username map = /etc/samba-dom2/smbusers

You should then be able to use chkconfig and service commands to turn on 
and off the smb and smb-dom2 services. Check thoroughly that they stop 
and start the correct instances!

In my setup, only the fist smb service has a winbind running, so I have 
not looked into setting up winbind for additional instances. There could 
be pitfalls!

Any feedback is appreciated. I really want to know how this works for you.


More information about the samba mailing list