You must choose to start smbd and nmbd either as daemons or from inetd. Don't try to do both! Either you can put them in inetd.conf and have them started on demand by inetd or xinetd, or you can start them as daemons either from the command line or in /etc/rc.local . See the man pages for details on the command line options. Take particular care to read the bit about what user you need to have to start Samba. In many cases, you must be root.
The main advantage of starting smbd and nmbd using the recommended daemon method is that they will respond slightly more quickly to an initial connection request.
35.5.1 Starting from inetd.conf
Look at your /etc/services . What is defined at port 139/tcp? If nothing is defined, then add a line like this:
Similarly for 137/udp, you should have an entry like:
Next, edit your /etc/inetd.conf and add two lines like this:
netbios-ssn stream tcp nowait root /usr/local/samba/bin/smbd smbd netbios-ns dgram udp wait root /usr/local/samba/bin/nmbd nmbd
The exact syntax of /etc/inetd.conf varies between UNIXes. Look at the other entries in inetd.conf for a guide.
Some distributions use xinetd instead of inetd. Consult the xinetd manual for configuration information.
Restart inetd, perhaps just send it a HUP.
root# killall -HUP inetd
35.5.2 Alternative: Starting smbd as a Daemon
To start the server as a daemon, you should create a script something like this one, perhaps calling it startsmb .
#!/bin/sh /usr/local/samba/bin/smbd -D /usr/local/samba/bin/nmbd -D
Make it executable with chmod +x startsmb
You can then run startsmb by hand or execute it from /etc/rc.local .
To kill it, send a kill signal to the processes nmbd and smbd.