Sams Teach Yourself Samba in 24 Hours

ContentsIndex

Hour 3: Obtaining the Latest Source

Previous HourNext Hour

Sections in this Chapter:

 

Hour 3
Obtaining the Latest Source

Every once and a while I see a message posted to one of the Samba mailing lists or a newsgroup saying something such as, "I'm running Samba version 1.0 and I can't get ____ to work." Invariably the answer comes back, "Upgrade to the latest version and if it still doesn't work, post your question again." Now I might be exaggerating about the version (for reference sake, the latest distributed version is 2.0 at the time I'm writing this), but it is important to realize the rate at which code develops and changes, especially in an open source software project such as Samba. The problem the person was experiencing might have been due to a known bug that was already fixed.

Maybe you are installing Samba for the first time, or maybe the person who maintained the Samba server left to make five times as much money. For whatever reason, sooner or later you need to obtain a copy of the latest source code and compile it yourself. In fact, you might find that it's something you look forward to.

This hour provides the information necessary to download the latest source and set any specific compile-time options. You'll also take a look at the binary distributions that are available (in case you don't feel like compiling things on your own).

Finding Out What Version of Samba You Currently Have

If you already have Samba running and want to determine whether you have the latest version, read on! If you are installing Samba for the first time, feel free to save this section for later use.

There are two simple ways to determine the version of Samba that is installed on your system. The first method uses the log files that the smbd and nmbd daemons create and leave behind, whereas the second involves obtaining information from the processes themselves.

First, look at the log files. A Samba server comprises two daemon processes: smbd and nmbd, which create logs that are located in /usr/local/samba/var by default and are usually named log.smb and log.nmb, respectively. It is possible to override where Samba places these by specifying a value in the configuration file. If you find that the log files are not located in /usr/local/samba/var, the next step is to find the configuration file, which is normally named smb.conf.

Normally the configuration file is located in /usr/local/samba/lib. As with most other values and locations in Samba, it is possible to override the location and name of smb.conf by passing a command-line argument to smbd and nmbd using the -s switch. Samba can be started either from the inetd metadaemon or as a daemon itself. To determine the methods that your systems uses, first look in /etc/inetd.conf by

grep smbd /etc/inetd.conf

If your system uses System V init scripts, such as Solaris 2.x or RedHat Linux, you can go to the startup script directory which is normally similar /etc/init.d or /etc/rc.d and run the command

grep smbd *

If you notice that a filename follows an -l switch when starting smbd, this is your debug log file. Otherwise, run the following command:

grep "log file" smb.conf

The resulting output should give an absolute path to a file. Look in this directory for the Samba logs.

After you find the correct log files, you should be able to determine the version of the Samba daemon that created them by searching the file:

root# grep "smbd version" log.smb | tail -1
  smbd version 2.1.0-prealpha started.

If you do not see something similar to the output listed previously, most likely what happened was that the logs either were written over by a cron job on the system or were rotated out by Samba itself because of their size. In order to get Samba to reprint the information, you can remove the logs and restart the smbd and nmbd processes.

It's impossible to describe how to restart Samba on every system on which it runs. This example from a Slackware 3.5 Linux system should give you a general idea:

[root@bilbo /etc] killall smbd
[root@bilbo /etc] killall nmbd
[root@bilbo /etc] /etc/rc.d/rc.samba

If you forget to remove the logs, Samba simply appends the new entries to the existing logs.

Caution - In Samba versions prior to 2.0, the default behavior for nmbd is to overwrite the old log.nmb file whereas smbd appends log entries. In version 2.0, both smbd and nmbd append log entries by default.

Another possible way to determine the version of Samba that is currently running is by using the smbclient utility that comes with the Samba distribution. Although this method is a lot simpler, it does require that smbclient be installed and that Samba is currently running. Locate the smbclient binary (usually in /usr/local/samba/bin) and run the following command:

smbclient -L localhost

As a result you should see something similar to the following (possibly mixed in with other text):

Added interface ip=aaa.bbb.ccc.ddd bcast=aaa.bbb.ccc.255 nmask=255.255.255.0
Domain=[CHIPSNDIPS] OS=[Unix] Server=[Samba 2.1.0-prealpha]
Sharename      Type      Comment
---------      ----      -------
...

The version information on the machine to which you are connected (the local machine) is printed in the brackets ([ ]) following the Server= label. This version in the previous example is "2.1.0-prealpha" (test code).

Sams Teach Yourself Samba in 24 Hours

ContentsIndex

Hour 3: Obtaining the Latest Source

Previous HourNext Hour

Sections in this Chapter: