Previous Next Contents

4. Running The Daemons

The two SMB daemons are /usr/sbin/smbd and /usr/sbin/nmbd.

You can run the Samba daemons from inetd or as stand-alone processes. If you are configuring a permanent file server, they should be run from inetd so that they will be restarted if they die. If you just want to use SMB services occasionally or to assist with systems administration, you can start them with an /etc/rc.d/init.d script or even by hand when you need them.

To run the daemons from inetd, place the following lines in the inetd configuration file, /etc/inetd.conf:


    # SAMBA NetBIOS services (for PC file and print sharing)
    netbios-ssn stream tcp nowait root /usr/sbin/smbd smbd
    netbios-ns dgram udp wait root /usr/sbin/nmbd nmbd

Then restart the inetd daemon by running the command:


    kill -HUP 1

To run the daemons from the system startup scripts, put the following script in file called /etc/rc.d/init.d/smb and symbolically link it to the files specified in the comments:


    #!/bin/sh

    #
    # /etc/rc.d/init.d/smb - starts and stops SMB services.
    #
    # The following files should be synbolic links to this file:
    # symlinks: /etc/rc.d/rc1.d/K35smb  (Kills SMB services on shutdown)
    #           /etc/rc.d/rc3.d/S91smb  (Starts SMB services in multiuser mode)
    #           /etc/rc.d/rc6.d/K35smb  (Kills SMB services on reboot)
    #

    # Source function library.
    . /etc/rc.d/init.d/functions

    # Source networking configuration.
    . /etc/sysconfig/network

    # Check that networking is up.
    [ ${NETWORKING} = "no" ] && exit 0

    # See how we were called.
    case "$1" in
      start)
        echo -n "Starting SMB services: "
        daemon smbd -D  
        daemon nmbd -D 
        echo
        touch /var/lock/subsys/smb
        ;;
      stop)
        echo -n "Shutting down SMB services: "
        killproc smbd
        killproc nmbd
        rm -f /var/lock/subsys/smb
        echo ""
        ;;
      *)
        echo "Usage: smb {start|stop}"
        exit 1
    esac


Previous Next Contents