Chapter 36. Analyzing and Solving Samba Problems

Gerald (Jerry) Carter

Samba Team

Jelmer R. Vernooij

The Samba Team

David Bannon

Samba Team

Dan Shearer

Samba Team

8 Apr 2003

Table of Contents

Diagnostics Tools
Debugging with Samba Itself
Tcpdump
Ethereal
The Windows Network Monitor
Useful URLs
Getting Mailing List Help
How to Get Off the Mailing Lists

There are many sources of information available in the form of mailing lists, RFCs and documentation. The documentation that comes with the Samba distribution contains good explanations of general SMB topics such as browsing.

Diagnostics Tools

With SMB networking, it is often not immediately clear what the cause is of a certain problem. Samba itself provides rather useful information, but in some cases you might have to fall back to using a sniffer. A sniffer is a program that listens on your LAN, analyzes the data sent on it and displays it on the screen.

Debugging with Samba Itself

One of the best diagnostic tools for debugging problems is Samba itself. You can use the -d option for both smbd and nmbd to specify the debug level at which to run. See the man pages for smbd, nmbd and smb.conf for more information regarding debugging options. The debug level can range from 1 (the default) to 10 (100 for debugging passwords).

Another helpful method of debugging is to compile Samba using the gcc -g flag. This will include debug information in the binaries and allow you to attach gdb to the running smbd/nmbd process. To attach gdb to an smbd process for an NT workstation, first get the workstation to make the connection. Pressing ctrl-alt-delete and going down to the domain box is sufficient (at least, the first time you join the domain) to generate a LsaEnumTrustedDomains. Thereafter, the workstation maintains an open connection and there will be an smbd process running (assuming that you haven't set a really short smbd idle timeout). So, in between pressing ctrl-alt-delete and actually typing in your password, you can attach gdb and continue.

Some useful Samba commands worth investigating are:

$ testparm | more
$ smbclient -L //{netbios name of server}

Tcpdump

Tcpdump was the first UNIX sniffer with SMB support. It is a command-line utility and now, its SMB support is somewhat lagging that of ethereal and tethereal.

Ethereal

Ethereal is a graphical sniffer, available for both UNIX (Gtk) and Windows. Ethereal's SMB support is quite good.

For details on the use of ethereal, read the well-written Ethereal User Guide.

Figure 36.1. Starting a capture.

Starting a capture.

Listen for data on ports 137, 138, 139, and 445. For example, use the filter port 137, port 138, port 139, or port 445 as seen in Starting a capture snapshot.

A console version of ethereal is available as well and is called tethereal.

Figure 36.2. Main ethereal data window.

Main ethereal data window.

The Windows Network Monitor

For tracing things on Microsoft Windows NT,Chapter 36. Analyzing and Solving Samba Problems

Chapter 36. Analyzing and Solving Samba Problems

Gerald (Jerry) Carter

Samba Team

Jelmer R. Vernooij

The Samba Team

David Bannon

Samba Team

Dan Shearer

Samba Team

8 Apr 2003

There are many sources of information available in the form of mailing lists, RFCs and documentation. The documentation that comes with the Samba distribution contains good explanations of general SMB topics such as browsing.

Diagnostics Tools

With SMB networking, it is often not immediately clear what the cause is of a certain problem. Samba itself provides rather useful information, but in some cases you might have to fall back to using a sniffer. A sniffer is a program that listens on your LAN, analyzes the data sent on it and displays it on the screen.

Debugging with Samba Itself

One of the best diagnostic tools for debugging problems is Samba itself. You can use the -d option for both smbd and nmbd to specify the debug level at which to run. See the man pages for smbd, nmbd and smb.conf for more information regarding debugging options. The debug level can range from 1 (the default) to 10 (100 for debugging passwords).

Another helpful method of debugging is to compile Samba using the gcc -g flag. This will include debug information in the binaries and allow you to attach gdb to the running smbd/nmbd process. To attach gdb to an smbd process for an NT workstation, first get the workstation to make the connection. Pressing ctrl-alt-delete and going down to the domain box is sufficient (at least, the first time you join the domain) to generate a LsaEnumTrustedDomains. Thereafter, the workstation maintains an open connection and there will be an smbd process running (assuming that you haven't set a really short smbd idle timeout). So, in between pressing ctrl-alt-delete and actually typing in your password, you can attach gdb and continue.

Some useful Samba commands worth investigating are:

$ testparm | more
$ smbclient -L //{netbios name of server}

Tcpdump

Tcpdump was the first UNIX sniffer with SMB support. It is a command-line utility and now, its SMB support is somewhat lagging that of ethereal and tethereal.

Ethereal

Ethereal is a graphical sniffer, available for both UNIX (Gtk) and Windows. Ethereal's SMB support is quite good.

For details on the use of ethereal, read the well-written Ethereal User Guide.

Figure 36.1. Starting a capture.

Starting a capture.

Listen for data on ports 137, 138, 139, and 445. For example, use the filter port 137, port 138, port 139, or port 445 as seen in Starting a capture snapshot.

A console version of ethereal is available as well and is called tethereal.

Figure 36.2. Main ethereal data window.

Main ethereal data window.

The Windows Network Monitor

For tracing things on Microsoft Windows NT,Chapter 36. Analyzing and Solving Samba Problems