35.5 Starting the smbd and nmbd


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

N OTE

graphics/round_pencil.gif

The following will be different if you use NIS, NIS+ or LDAP to distribute services maps.


Look at your /etc/services . What is defined at port 139/tcp? If nothing is defined, then add a line like this:

 
 netbios-ssn 139/tcp 

Similarly for 137/udp, you should have an entry like:

 
 netbios-ns 137/udp 

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.

N OTE

graphics/round_pencil.gif

Some UNIXes already have entries like netbios_ns (note the underscore ) in /etc/services . You must edit /etc/services or /etc/inetd.conf to make them consistent.


N OTE

graphics/round_pencil.gif

On many systems you may need to use the interfaces option in smb.conf to specify the IP address and netmask of your interfaces. Run ifconfig as root if you do not know what the broadcast is for your net. nmbd tries to determine it at run time, but fails on some UNIXes.


W ARNING

graphics/exclamatory.gif

Many UNIXes only accept around five parameters on the command line in inetd.conf . This means you shouldn't use spaces between the options and arguments, or you should use a script and start the script from inetd .


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.

N OTE

graphics/round_pencil.gif

If you use the SVR4 style init system, you may like to look at the examples/svr4-startup script to make Samba fit into that system.




Official Samba-3 HOWTO and Reference Guide
The Official Samba-3 HOWTO and Reference Guide, 2nd Edition
ISBN: 0131882228
EAN: 2147483647
Year: 2005
Pages: 297

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net