All major Linux distributions ship with Samba, the Server Message Block/Common Internet File System (SMB/CIFS) server for Unix-like systems. This server package enables Linux to serve files and printers to Windows clients, providing a reliable and low-cost platform to fill this role. In fact, despite some fundamental differences between the Linux/Unix and Windows platforms, Samba handles its duties so well that Samba servers are often more trouble-free than their Windows counterparts, so network administrators have sometimes gone to great lengths to deploy Linux running Samba rather than Windows in this role.
This chapter describes basic Samba configuration, starting with installing the server. Other topics include the configuration file format, how you identify the server to other computers on the network, minimal options to help Samba get along with other systems in terms of its browsing features, and setting password options. You must set these basic features before you can move on to the next topic, configuring file and printer shares; that topic is covered in Chapter 4.
An experienced Samba administrator who’s familiar with the local network can set all the options described in this chapter in just a minute or two. Many of these options require some time to fully describe because of changes in SMB/CIFS over time and because of peculiarities of integrating SMB/CIFS with Linux’s traditional networking tools, but you’ll change only a handful of Samba configuration file options. If you’re impatient to get started, pay particular attention to Section 3.3.2 and Section 3.5.
Samba isn’t a single server; rather, it’s a family of servers that together provide the full functionality of the package. (Nonetheless, references to “the Samba server” or similar phrases are common.) Four daemons provide the most important Samba features.
This daemon handles the file- and printer-serving functions per se. Clients connect to it using TCP port 139 or 445 to request the transfer of files.
This daemon handles most of the SMB/CIFS functionality not provided by smbd, including NetBIOS name resolution (as described in Section 3.3) and browsing features (as described briefly in the Section 3.4 and in more detail in Chapter 5). Iff you run smbd, chances are you’ll also run nmbd. This server binds to UDP ports 137 and 138.
The Samba Web Administration Tool (SWAT) provides a web-based GUI administration tool for Samba. Running it isn’t necessary, and I don’t describe it further in this book. It can be a handy tool for new Samba administrators, though, and it provides some functions that can help ordinary users, such as an interface to change their passwords. It usually runs on TCP port 901.
This daemon, which is also known as winbindd, provides a way for Linux to access NetBIOS name and Windows NT domain information. The main upshot is that a system that runs Winbind can authenticate its local users against the Windows domain’s user database, as described in Chapter 7. Although Winbind is a daemon, it isn’t a server for other computers; it enables extra functionality solely for the computer on which it runs.
In addition to these daemons, Samba provides a number of support utilities and client programs. These include the smbclient client program, which provides FTP-like access to SMB/CIFS shares; the smbmount utilities, which helps you mount SMB/CIFS shares in Linux; and the smbpasswd utility for handling Samba passwords. Some of these tools are described in this chapter, but others are covered elsewhere in this book.
Most Linux distributions deliver these programs in one or more
packages. Typically, a base
package
is called samba or
samba-common. Additional functionality often
ships in other packages, such as samba-clients
or swat. Consult your
distribution’s package list and descriptions to
learn what you need to install for the functionality you require.
Alternatively, you can download and install Samba from its own web
site, http://www.samba.org. This
site’s download area provides links to binaries for
many distributions and to a source code tarball that should compile
on any Linux distribution. (Just one source tarball contains all the
major Samba components described here.)
Samba (or at least the smbd and
nmbd daemons) is typically launched through SysV
startup scripts, and these usually install from the
distribution’s main Samba package. If you installed
Samba from a source tarball, though, you’ll need to
create your own SysV startup script, run Samba from a local startup
script, or launch Samba manually on an as-needed basis. (The
packaging subdirectory of the Samba source
package includes sample SysV startup scripts for several
distributions.) Although it’s possible to run Samba
from a super server such as inetd or
xinetd, doing so is uncommon and
isn’t recommended. In fact, nmbd
tends to be a bit difficult to run in this way.
A few features related to SMB/CIFS aren’t part of the main Samba package. Most notably, the ability to mount SMB/CIFS shares on a Linux system is built into the Linux kernel, although it relies on the external smbmount command, which is part of the Samba package. Some GUI SMB/CIFS network browsers are also available separately. Many of these tools nonetheless rely on the basic Samba configuration described in this chapter for certain default values.