Introduction to Samba

The Samba package provides file and print services to SMB/CIFS clients and Windows networking to Linux clients.

Package information

Additional downloads

Installation of Samba

Install Samba by running the following commands:

patch -Np1 -i samba-3.0.4-maintainer.patch &&
cd source &&
install -d /var/cache/samba &&
./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --with-piddir=/var/run \
    --with-fhs \
    --with-smbmount &&
make &&
make install &&
install -m755 nsswitch/libnss_win{s,bind}.so /lib &&
ln -sf /lib/ &&
ln -sf /lib/ &&
cp ../examples/smb.conf.default /etc/samba


You may want to run configure with the --help parameter. There may be other parameters needed to take advantage of the optional dependencies.

Installation command explanations

install -d /var/cache/samba: This directory is needed for proper operation of the smbd and nmbd daemons.

--sysconfdir=/etc: Sets the configuration file directory to avoid the default of /usr/etc.

--localstatedir=/var: Sets the variable data directory to avoid the default of /usr/var.

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

--with-smbmount: Orders the creation of an extra binary for use by the mount command so that mounting remote SMB (Windows) shares becomes no more complex than mounting remote NFS shares.

install -m755 nsswitch/libnss_win{s,bind}.so /lib: The nss libraries are not installed by default. If you intend to use winbindd for domain auth, and/or WINS name resolution, you need these libraries.

ln -sf /lib/ and ln -sf /lib/ These symlinks are required by glibc to use the nss libraries.

cp ../examples/smb.conf.default /etc/samba: This copies a default smb.conf into /etc/samba. This sample configuration will not work unless edited for your site, and renamed smb.conf.

Configuring Samba

Because of the various uses for Samba, complete configuration is well beyond the scope of the BLFS book. In fact, many complete books have been written on this topic alone. The included documentation, a popular book published by O'Reilly, can be viewed by pointing your web browser to file:///usr/share/samba/swat/using_samba/toc.html.

The built in SWAT (Samba Web Administration Tool) utility can be used for basic configuration, however, before using SWAT you must add an entry to /etc/services and make changes to your inetd/xinetd configuration.

Add the swat entry to /etc/services with the following command:

echo "swat            901/tcp" >> /etc/services

If inetd is used, the following command will add the swat entry to /etc/inetd.conf:

echo "swat stream tcp nowait.400 root /usr/sbin/swat swat" \
    >> /etc/inetd.conf

Issue a killall -HUP inetd to reread the changed inetd.conf file.

If xinetd is used, the following command will add the swat entry to /etc/xinetd.conf:

cat >> /etc/xinetd.conf << "EOF"
service swat
    port            = 901
    socket_type     = stream
    wait            = no
    only_from       =
    user            = root
    server          = /usr/sbin/swat
    log_on_failure  += USERID

Issue a killall -HUP xinetd to reread the changed xinetd.conf file.

SWAT can be launched by pointing your web browser to http://localhost:901.

For your convenience, boot scripts have been provided for Samba. There are two included in the blfs-bootscripts-5.1 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.

Install the samba script with the following command:

make install-samba

If you also need the winbind script:

make install-winbind


The Samba package contains make_smbcodepage, make_unicodemap, mount.smbfs, net, nmbd, nmblookup, rpcclient, smbcacls, smbclient, smbcontrol, smbd, smbpasswd, smbspool, smbstatus, swat, testparm, testprns, wbinfo and winbindd.



make_smbcodepage converts text descriptions of code pages to binary code page files and vice versa.


make_unicodemap converts text Unicode map files to binary, for use in mapping characters to 16 bit Unicode.


mount.smbfs provides /bin/mount with a way to mount remote Windows (or Samba) fileshares.


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


nmbd is the Samba NetBIOS name server.


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


rpcclient is used to execute MS-RPC client side functions.


smbcacls is used to manipulate NT access control lists.


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


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


smbd is the main Samba daemon.


smbpasswd changes a user's Samba password.


smbspool sends a print job to an SMB printer.


smbstatus reports current Samba connections.


swat is the Samba Web Administration Tool.


testparm checks an smb.conf file for proper syntax.


testprns tests printer names.


wbinfo queries a running winbindd daemon.


winbindd resolves names from NT servers.