Samba is a popular open source software package that provides file and print services using the SMB/CIFS protocol. This protocol is built into MicrosoftWindows systems. It can be added to non-MicrosoftWindows systems by installing the Samba client libraries. The protocol allows clients to access shared data and printers. These shares can be mapped as a local disk drive and shared printers can be used as if they were local printers.
On FreeBSD, the Samba client libraries can be installed using the net/samba-smbclient port or package. The client provides the ability for a FreeBSD system to access SMB/CIFS shares in a MicrosoftWindows network.
A FreeBSD system can also be configured to act as a Samba server by installing the net/samba43 port or package. This allows the administrator to create SMB/CIFS shares on the FreeBSD system which can be accessed by clients running MicrosoftWindows or the Samba client libraries.
Samba is configured in
/usr/local/etc/smb4.conf. This file must
be created before Samba
can be used.
smb4.conf to share
directories and printers with Windows clients in a
workgroup is shown here. For more complex setups
involving LDAP or Active Directory, it is easier to use
samba-tool(8) to create the initial
[global] workgroup = WORKGROUP server string = Samba Server Version %v netbios name = ExampleMachine wins support = Yes security = user passdb backend = tdbsam # Example: share /usr/src accessible only to 'developer' user [src] path = /usr/src valid users = developer writable = yes browsable = yes read only = no guest ok = no public = no create mask = 0666 directory mask = 0755
Settings that describe the network are added in
The name of the workgroup to be served.
The NetBIOS name by which a Samba server is known. By default, it is the same as the first component of the host's DNS name.
The string that will be displayed in the output of
net viewand some other networking tools that seek to display descriptive text about the server.
Whether Samba will act as a WINS server. Do not enable support for WINS on more than one server on the network.
The most important settings in
/usr/local/etc/smb4.conf are the
security model and the backend password format. These
directives control the options:
The most common settings are
security = shareand
security = user. If the clients use usernames that are the same as their usernames on the FreeBSD machine, user level security should be used. This is the default security policy and it requires clients to first log on before they can access shared resources.
In share level security, clients do not need to log onto the server with a valid username and password before attempting to connect to a shared resource. This was the default security model for older versions of Samba.
Samba has several different backend authentication models. Clients may be authenticated with LDAP, NIS+, an SQL database, or a modified password file. The recommended authentication method,
tdbsam, is ideal for simple networks and is covered here. For larger or more complex networks,
smbpasswdwas the former default and is now obsolete.
FreeBSD user accounts must be mapped to the
SambaSAMAccount database for
Windows clients to access the share.
Map existing FreeBSD user accounts using
This section has only mentioned the most commonly used settings. Refer to the Official Samba HOWTO for additional information about the available configuration options.
To enable Samba at boot time,
add the following line to
To enable Samba4, use:
To start Samba now:
service samba startStarting SAMBA: removing stale tdbs : Starting nmbd. Starting smbd.
Samba consists of three
separate daemons. Both the nmbd
and smbd daemons are started by
samba_enable. If winbind name resolution
is also required, set:
Samba can be stopped at any time by typing:
service samba stop
Samba is a complex software
suite with functionality that allows broad integration with
MicrosoftWindows networks. For more information about
functionality beyond the basic configuration described here,