Section 2.3. Compiling and Installing Samba

2.3. Compiling and Installing Samba

At this point you should be ready to build the Samba executables. Compiling is even easier than configuration: in the source directory, type make on the command line. The make utility will produce a stream of explanatory and success messages, beginning with:

 Using FLAGS = -O -Iinclude ... 

This build includes all the mentioned Samba client and server binaries. If you encounter a problem when compiling, first check the Samba documentation to see whether it is easily fixable. Another possibility is to search or post to the Samba mailing lists, links to which are given at the end of Chapter 12 and on the Samba home page. Most compilation issues are system-specific and almost always easy to overcome.

Now that the files have been compiled, you can install them in the directories you identified. Make sure to change to the root user before running the following command:

 $ make install 

If you configured Samba to use the default locations for files, the new files will be installed in the directories listed in Table 2-2.

Table 2-2. Samba installation directories




Main tree


Client binaries and administartive tools


Server binaries


smb.conf, lmhosts, configuration files, and so on


Samba documentation


Samba-encrypted password file


SWAT files


Samba logfiles, lock files, tdb files, browse list info, shared memory files, process ID files

The remainder of the book assumes a default install location of /usr/local/samba. Beware that this can vary from system to system. Many vendors install Samba either to /opt or to /usr by default. If you are using a prepackaged version of Samba or have inherited a Samba server from a past administrator, be sure that you find out where the various tools, daemons, and configuration data were installed.

If you happen to be upgrading into the same directory tree as a previous Samba installation, the preexisting client tools and server binaries are saved with the extension .old, and you can go back to that previous version with the command make revert. After issuing make install, you should copy the .old files (if they exist) to a new location or name. Otherwise, the next time you install Samba (or even run make install a second time), the original .old will be overwritten without warning and you could lose your earlier version.

Congratulations! You now have Samba on your system!

2.3.1. Upgrading Your Installation

Eventually a new version of Samba will be released, and you will want to upgrade. Just repeat the same steps you used to install your current version. Download the source distribution from the Samba web site, unpack it, and then run the ./configure, make, and make install commands as before. If you've forgotten which options you used with the configure script, either take a look at the source/config.status file in your previous version's source distribution or examine the output of smbd -b to determine which features and directories were used. The config.status file is similar to a cache file. Its first few lines will show the options used the last time configure was run.

When upgrading, it is a good idea to back up a few important files in case something goes wrong. Samba developers support upgrades of Samba databases from one version to the next. However, downgrading is not supported. So keep a copy of the files listed in Table 2-3.[*]

[*] The list of tdb files might change in future releases, so be sure to check the WHATSNEW.txt file for updates.

Table 2-3. Important Samba configuration files




Main configuration file.


This directory contains sensitive data about such things as user passwords and important state information, such as the local machine security identifier (SID).


These database files contain information about printers, queues, and installed print drivers on the system.


Contains the security descriptors assigned to file shares.


Contains the table of Windows groups SID to Unix group IDs.


Local account policy data, such as password expiration time and account lockout settings.


Maintains the mappings between Windows users and groups and the allocated Unix uids and gids. Important only if you are running the winbindd daemon.

Table 2-4 gives a brief description of the remaining tdb files. These files either maintain runtime state information, and are therefore recreated by the Samba daemons on startup, or store cache information that can be rebuilt as necessary.

Table 2-4. Samba's volatile tdb and datafiles




Maintains information about open byte range file locks.


Contains data about open files, granted oplocks, and share mode entries on files.


Maintains data necessary to implement Samba deferred file open semantics in conjunction with file locks.


Stores the list of active CIFS session UIDs.


Information regarding open share connections.


Caches the queue listing of each available printer in smb.conf.


Performance counters (if configured) to be returned to clients querying the HKPD registry hive.


Eventlogs (if configured).


Generic caching database used for such things as failed name resolution.


Cache of the failed login attempts used to enforce the password lockout policy setting.


Cache of user and group information obtained in replies from domain controllers when authenticating via NTLM.


Implementation of the Windows registry for Samba servers. Currently, the file is rebuilt at startup and contains no sensitive or critical data.


List of unhandled packets returned from Windows clients on port 137 or 138.


Cache file used by the winbindd daemon to improve performance when handling requests such as enumerating domain users and groups and mapping names to Windows sids.


State information maintained by nmbd in relation to network browsing elections.



Contains the most recent dump of nmbd's internal WINS database. This file is applicable only when the wins support parameter has been enabled in smb.conf.

2.3.2. Reconfiguring Samba

If you have already compiled Samba and wish to recompile the same source code with different configure options, run the following command in the source directory before rerunning the configure script:

 $ make distclean 

This ensures that you are starting with a clean slate and that your previous configure command does not leave any files laying around that can affect your new build. From here, you can rerun ./configure and then make and make install.

2.3.3. Setting Search Paths

You will probably want to run commands included in the Samba distribution without having to specify their full directory paths. For that to work, the directory in which the Samba executables are located, /usr/local/samba/{bin,sbin} by default, must be added to your shell's PATH environment variable. This environment variable is usually set in one or more of the shell's startup files, which in the case of bash are /etc/profile (systemwide) and the .profile, .bash_profile, and .bashrc files in each user's home directory.

To be able to read the Samba manual pages using the man command, the directory where Samba's manual pages reside, /usr/local/samba/man by default, must be in your MANPATH environment variable. On SUSE Linux, this can be accomplished by adding the following two lines to /etc/manpath.config:

 MANPATH      /usr/local/samba/man MANPATH_MAP  /usr/local/samba/bin /usr/local/samba/man 

Other systems might just require a line such as the following in your shell's initialization file:

 export MANPATH=$MANPATH:/usr/local/samba/man 

Using Samba
Using Samba: A File and Print Server for Linux, Unix & Mac OS X, 3rd Edition
ISBN: 0596007698
EAN: 2147483647
Year: 2004
Pages: 135

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: