Network Administration: Starting and Stopping Samba

After completing the installation and before you can use Samba, you must start its two daemons, smbd and nmbd. Both can be started at once by starting the SMB service. From a command shell, use this command:

service smb start

Whenever you make a configuration change, such as adding a new share or creating a new Samba user, you should stop and restart the service with these commands:

service smb restart

If you prefer, you can stop and start the service with separate commands:

service smb stop
service smb start

If you’re not sure whether Samba is running, enter this command:

service smb status

You get a message indicating whether the smbd and nmbd daemons are running.

To configure Samba to start automatically when you start Linux, use this command:

chkconfig -level 35 smb on

To make sure that the chkconfig command worked right, enter this command:

chkconfig -list smb

You should see output similar to the following:

Smb      0:off  1:off  2:off  3:on   4:off  5:on   6:off

You can independently configure services to start automatically for each of the six boot levels of Linux. Boot level 3 is normal operation without an X server; level 5 is normal operation with an X server. So setting SMB to start for levels 3 and 5 makes SMB available — regardless of whether you’re using a graphical user interface.

You can also start and stop Samba by using the Service Configuration tool, shown in the following figure.. Scroll down the list of services until you find the SMB service. You can use the three buttons on the toolbar at the top of the window to start, stop, or restart a service.

image0.jpg

You can also use the Service Configuration tool to start Samba automatically, although frankly, the chkconfig command is easier to use. To configure Samba to start automatically for levels 3 and 5, follow these steps:

  1. Select the SMB in the list of services.

  2. Click the Customize button.

    This brings up a dialog box that lists five run levels.

  3. Make sure all five check boxes are selected.

  4. Click OK.