Introduction to Samba

The Samba package provides file and print services to SMB/CIFS clients and Windows networking to Linux clients. Samba can also be configured as a Windows Domain Controller replacement, a file/print server acting as a member of a Windows Active Directory domain and a NetBIOS (rfc1001/1002) nameserver (which among other things provides LAN browsing support).

This package is known to build and work properly using an LFS-9.0 platform.

Package Information

  • Download (HTTP):

  • Download MD5 sum: 05472d0dd943b3ccbc3be5032a9eb563

  • Download size: 17 MB

  • Estimated disk space required: 496 MB (add 16 MB for quicktest)

  • Estimated build time: 2.8 SBU (using parallelism=4; add 0.8 SBU for quicktest)

Samba Dependencies


jansson-2.12, libtirpc-1.1.4, lmdb-0.9.24, Python-2.7.16, and rpcsvc-proto-1.4



Avahi-0.7, BIND-9.14.5, Cups-2.2.12, Cyrus SASL-2.1.27, GDB-8.3, git-2.23.0, GnuPG-2.2.17 (required for ADS and testsuite), GnuTLS-3.6.9, libaio-0.3.112, libarchive-3.4.0, libcap-2.27 with PAM, libgcrypt-1.8.5, libnsl-1.2.0, Linux-PAM-1.3.1, MIT Kerberos V5-1.17, NSS-3.45, popt-1.16, Talloc-2.2.0 (included), Vala-0.44.7, Valgrind-3.15.0 (optionally used by the test suite), Wireshark-3.0.3 (module installed), xfsprogs-5.2.1, cmocka, ctdb (included), cwrap, dnspython, FAM, Gamin, GlusterFS, Heimdal (included), libunwind, ldb (included), M2Crypto (required for ADS), OpenAFS, PyGPGME (recommended for ADS), tevent (included), and tdb (included)

Optional (for the Developer Test Suite)

Install in listed order: six-1.12.0, argparse, extras, py, enum34, hypothesis, pytest, coverage, pytest-cov, doctools, unittest2, testtools, fixtures, python-mimeparse, contextlib2, traceback2, linecache2, testscenarios, testresources, virtualenv, pbr, and python-subunit

User Notes:

Installation of Samba

Fix a test that always fails:

echo "^samba4.rpc.echo.*on.*ncacn_np.*with.*object.*nt4_dc" >> selftest/knownfail

Install Samba by running the following commands:

CFLAGS="-I/usr/include/tirpc"          \
LDFLAGS="-ltirpc"                      \
./configure                            \
    --prefix=/usr                      \
    --sysconfdir=/etc                  \
    --localstatedir=/var               \
    --with-piddir=/run/samba           \
    --with-pammodulesdir=/lib/security \
    --enable-fhs                       \
    --without-ad-dc                    \
    --without-systemd                  \
    --enable-selftest                  &&

To test the results, as the root user, issue: make quicktest. The test suite will produce lines that look like failures, but these are innocuous. The last few lines of output should report "ALL OK" for a good test run. A summary of any failures can be found in ./st/summary.



Additionally, developer test suites are available. If you've installed the optional python modules above, you can run these tests with make test. It is not recommended for the average builder at around 290 SBU and over a gigabyte of disk space, and you should expect ~73 errors and ~30 failures from the 3000+ tests.

Now, as the root user:

make install &&

mv -v /usr/lib/libnss_win{s,bind}.so*   /lib                       &&
ln -v -sf ../../lib/ /usr/lib/ &&
ln -v -sf ../../lib/    /usr/lib/    &&

install -v -m644    examples/smb.conf.default /etc/samba &&

mkdir -pv /etc/openldap/schema                        &&

install -v -m644    examples/LDAP/README              \
                    /etc/openldap/schema/README.LDAP  &&

install -v -m644    examples/LDAP/samba*              \
                    /etc/openldap/schema              &&

install -v -m755    examples/LDAP/{get*,ol*} \

Command Explanations

--enable-fhs: Assigns all other file paths in a manner compliant with the Filesystem Hierarchy Standard (FHS).

--without-systemd: Disable systemd integration, since it is not built in the System V version of LFS/BLFS.

--without-ad-dc: Disable Active Directory Domain Controller functionality. See Setup a Samba Active Directory Domain Controller for detailed information. Remove this switch if you've installed the Python modules needed for ADS support. Note that BLFS does not provide a samba bootscript for an Active Directory domain controller.

--with-selftest-prefix=SELFTEST_PREFIX: This option specifies the test suite work directory (default=./st).

mv -v /usr/lib/libnss_win{s,bind}.so* /lib: The nss libraries are installed in /usr/lib by default. Move them to /lib.

ln -v -sf ../../lib/ /usr/lib/ and ln -v -sf ../../lib/ /usr/lib/ These symlinks are required when applications build against these libraries.

install -v -m644 examples/LDAP/* /etc/openldap/schema: These commands are used to copy sample Samba schemas to the OpenLDAP schema directory.

install -v -m644 ../examples/smb.conf.default /etc/samba: This copies a default smb.conf file into /etc/samba. This sample configuration will not work until you copy it to /etc/samba/smb.conf and make the appropriate changes for your installation. See the configuration section for minimum values which must be set.

Configuring Samba

Config Files


Printing to SMB Clients

If you use CUPS for print services, and you wish to print to a printer attached to an SMB client, you need to create an SMB backend device. To create the device, issue the following command as the root user:

ln -v -sf /usr/bin/smbspool /usr/lib/cups/backend/smb

Configuration Information

Due to the complexity and the many various uses for Samba, complete configuration for all the package's capabilities is well beyond the scope of the BLFS book. This section provides instructions to configure the /etc/samba/smb.conf file for two common scenarios. The complete contents of /etc/samba/smb.conf will depend on the purpose of Samba installation.



You may find it easier to copy the configuration parameters shown below into an empty /etc/samba/smb.conf file instead of copying and editing the default file as mentioned in the “Command Explanations” section. How you create/edit the /etc/samba/smb.conf file will be left up to you. Do ensure the file is only writeable by the root user (mode 644).

Scenario 1: Minimal Standalone Client-Only Installation

Choose this variant if you only want to transfer files using smbclient, mount Windows shares and print to Windows printers, and don't want to share your files and printers to Windows machines.

A /etc/samba/smb.conf file with the following three parameters is sufficient:

    workgroup = MYGROUP
    dos charset = cp850
    unix charset = ISO-8859-1

The values in this example specify that the computer belongs to a Windows workgroup named “MYGROUP”, uses the “cp850” character set on the wire when talking to MS-DOS and MS Windows 9x, and that the filenames are stored in the “ISO-8859-1” encoding on the disk. Adjust these values appropriately for your installation. The “unix charset” value must be the same as the output of locale charmap when executed with the LANG variable set to your preferred locale, otherwise the ls command may not display correct filenames of downloaded files.

There is no need to run any Samba servers in this scenario, thus you don't need to install the provided bootscripts.

Scenario 2: Standalone File/Print Server

Choose this variant if you want to share your files and printers to Windows machines in your workgroup in addition to the capabilities described in Scenario 1.

In this case, the /etc/samba/smb.conf.default file may be a good template to start from. Also add “dos charset” and “unix charset” parameters to the “[global]” section as described in Scenario 1 in order to prevent filename corruption. For security reasons, you may wish to define path = /home/alice/shared-files, assuming your user name is alice and you only want to share the files in that directory, instead of your entire home. Then, replace homes by shared-files and change also the “comment” if used the configuration file below or the /etc/samba/smb.conf.default to create yours.

The following configuration file creates a separate share for each user's home directory and also makes all printers available to Windows machines:

    workgroup = MYGROUP
    dos charset = cp850
    unix charset = ISO-8859-1

    comment = Home Directories
    browseable = no
    writable = yes

    comment = All Printers
    path = /var/spool/samba
    browseable = no
    guest ok = no
    printable = yes

Other parameters you may wish to customize in the “[global]” section include:

    server string =
    security =
    hosts allow =
    load printers =
    log file =
    max log size =
    socket options =
    local master =

Reference the comments in the /etc/samba/smb.conf.default file for information regarding these parameters.

Since the smbd and nmbd daemons are needed in this case, install the samba bootscript. Be sure to run smbpasswd (with the -a option to add users) to enable and set passwords for all accounts that need Samba access. Using the default Samba passdb backend, any user you attempt to add will also be required to exist in the /etc/passwd file.

Advanced Requirements

More complex scenarios involving domain control or membership are possible. Such setups are advanced topics and cannot be adequately covered in BLFS. Many complete books have been written on these topics alone. Note that in some domain membership scenarios, the winbindd daemon and the corresponding bootscript are needed.

There is quite a bit of documentation available which covers many of these advanced configurations. Point your web browser to the links below to view some of the documentation included with the Samba package:

Guest account

The default Samba installation uses the nobody user for guest access to the server. This can be overridden by setting the guest account = parameter in the /etc/samba/smb.conf file. If you utilize the guest account = parameter, ensure this user exists in the /etc/passwd file.

Boot Script

For your convenience, boot scripts have been provided for Samba. There are two included in the blfs-bootscripts-20190609 package. The first, samba, will start the smbd and nmbd daemons needed to provide SMB/CIFS services. The second script, winbind, starts the winbindd daemon, used for providing Windows domain services to Linux clients.

make install-samba
make install-winbindd


Installed Programs: cifsdd, dbwrap_tool, dumpmscat, eventlogadm, findsmb,gentest, ldbadd, ldbdel, ldbedit, ldbmodify, ldbrename, ldbsearch, locktest, masktest, mvxattr, ndrdump, net, nmbd, nmblookup, ntlm_auth, oLschema2ldif, pdbedit, pidl, profiles, regdiff, regpatch, regshell, regtree, rpcclient, samba, samba_dnsupdate, samba_kcc, samba-gpupdate, samba-regedit, samba_spnupdate, samba-tool, samba_upgradedns, sharesec, smbcacls, smbclient, smbcontrol, smbcquotas, smbd, smbget, smbpasswd, smbspool, smbstatus, smbtar, smbtorture, smbtree, tdbbackup, tdbdump, tdbrestore, tdbtool, testparm, wbinfo, and winbindd
Installed Libraries:,,,,,,,,,,,,,,,,,,,,,,, and; the PAM library; and assorted character set, filesystem and support modules under /usr/lib/{python2.7,samba}
Installed Directories: /etc/samba, /run/samba, /usr/include/samba-4.0, /usr/lib/perl5/vendor_perl/5.x.y/Parse/Pidl/{Samba{3,4},Wireshark}, /usr/lib/python3.7/site-packages/samba, /usr/libexec/samba, /usr/{lib,share}/samba, and /var/{cache,lib,lock,log,run}/samba

Short Descriptions


is the dd command for SMB.


is used to read and manipulate TDB/CTDB databases using the dbwrap interface.


is used to write records to eventlogs from STDIN, add the specified source and DLL eventlog registry entries and display the active eventlog names (from smb.conf).


is used to list info about machines that respond to SMB name queries on a subnet.


is used to run random generic SMB operations against two SMB servers and show the differences in behavior.


is a command-line utility for adding records to an LDB database.


is a command-line program for deleting LDB database records.


allows you to edit LDB databases using your preferred editor.


allows you to modify records in an LDB database.


allows you to rename LDB databases.


searches an LDB database for records matching a specified expression.


is used to find differences in locking between two SMB servers.


is used to find differences in wildcard matching between Samba's implementation and that of a remote server.


is used to recursively rename extended attributes.


is a DCE/RPC Packet Parser and Dumper.


is a tool for administration of Samba and remote CIFS servers, similar to the net utility for DOS/Windows.


is the Samba NetBIOS name server.


is used to query NetBIOS names and map them to IP addresses.


is a tool to allow external access to Winbind's NTLM authentication function.


converts LDAP schema's to LDB-compatible LDIF.


is a tool used to manage the SAM database.


is an IDL (Interface Definition Language) compiler written in Perl.


is a utility that reports and changes SIDs in Windows registry files. It currently only supports Windows NT.


is a Diff program for Windows registry files.


applies registry patches to registry files.


is a Windows registry file browser using readline.


is a text-mode registry viewer.


is used to execute MS-RPC client side functions.


is a server to provide AD and SMB/CIFS services to clients.


is used to update our DNS names using TSIG-GSS.


is a script used to compute your KCC (Knowledge Consistency Checker) topology.


allows you to edit Microsoft Group Policy Objects (GPOs).


is a ncurses based tool to manage the Samba registry.


is a script to update the servicePrincipalName names from spn_update_list.


is the main Samba administration tool.


is a Unix SMB/CIFS implementation.


manipulates share ACL permissions on SMB file shares.


is used to manipulate Windows NT access control lists.


is a SMB/CIFS access utility, similar to FTP.


is used to control running smbd, nmbd and winbindd daemons.


is used to manipulate Windows NT quotas on SMB file shares.


is the main Samba daemon which provides SMB/CIFS services to clients.


is a simple utility with wget-like semantics, that can download files from SMB servers. You can specify the files you would like to download on the command-line.


changes a user's Samba password.


sends a print job to an SMB printer.


reports current Samba connections.


is a shell script used for backing up SMB/CIFS shares directly to Linux tape drives or a file.


is a testsuite that runs several tests against a SMB server.


is a text-based SMB network browser.


is a tool for backing up or validating the integrity of Samba .tdb files.


is a tool used to print the contents of a Samba .tdb file.


is a tool for creating a Samba .tdb file out of a ntdbdump.


is a tool which allows simple database manipulation from the command line.


checks an smb.conf file for proper syntax.


queries a running winbindd daemon.


resolves names from Windows NT servers.

provides Name Service Switch API functions for resolving names from NT servers.

provides API functions for Samba's implementation of the Windows Internet Naming Service.

provides the API functions for the administration tools used for Samba and remote CIFS servers.

provides the API functions for the Samba SMB client tools.

provides API functions for Windows domain client services.

Last updated on 2019-08-25 11:35:01 -0700