Samba Server   «Prev  Next»

Lesson 5Testing a Samba Server's Configuration
ObjectiveTest a Samba Server's Configuration.

Testing a Samba Server's Configuration

Because of Samba's many configuration options, it's very easy to misconfigure your Samba server. Samba designers recognized this problem, so they provided several methods for you to validate your configuration.
Before testing, make sure you have an entry for the server in your Windows hosts file. If you don't have DNS enabled, you should also have an entry for each client in the Linux

/etc/hosts 
file.

The testparm command

Every time you make changes to /etc/smb.conf, you should run the testparm command. This command verifies Samba's configuration file's syntax and prints out the configuration values you specified.
To use this command, type it on the command line followed by the path to your Samba's configuration. The command line typically looks like this:

testparm /etc/smbconf 

Share names

Before you can test out your shares, you need to understand how Samba names shares. To name a share, specify the server's and share's name using the //server/share syntax. For example, if the "smbserv" machine has a share named "tmp," you would access it with //smbserv/tmp.

The smbclient command

Once you have verified the syntax in /etc/smb.conf, you should exercise the Samba server to verify it's providing services the way you expect.
The smbclient program allows you to access your Samba server directly. This command, in some ways, imitates what a true SMB client would do. You can list shares, access shares, and read, write, copy, or delete files.
To list shares, pass the -L parameter to smbclient. For example, to list all services on the "smbserv" machine, use smbclient -L //smbserv.
To interactively access a share's contents, pass the share's name to smbclient, for example, smbclient //smbserv/projects.
Pass the -U flag to smbclient to specify a valid connecting user. For example, if there is an "AEinstein" user on your Samba server, interactively connect to shares with smbclient //server/share -U AEinstein.

View the slide show below to see a demonstration of these steps.
Test Samba Server
Before you make your Samba server available for public consumption, make certain you've thorougly tested every share. Giving the wrong access to a share might compromise your sensitive data.
In the next lesson, you will learn how to secure a Samba server.

Samba - Quiz

Before moving to the next lesson, click the Quiz link below to check your understanding of Samba.
Linux Samba - Quiz