Samba configuration is controlled by the smb.conf(4) file. For complete information about the layout of the smb.conf file and a description of all available parameters, see the smb.conf(4) man page.
This chapter discusses the following:
The smb.conf file contains sections and parameters that pertain to each section. Section names are contained within square brackets. Parameters consist of a parameter name and a value. The format of the file is as follows:
[section_name] parameter_name1 = value1 parameter_name2 = value2 |
The global section contains parameters that control the overall behavior of Samba, such as the workgroup name and the NetBIOS name of the server. Other sections define shares (printers or directories in a filesystem) that will be made available to clients by Samba.
The following is a brief description of the parameters in the global section that are set by FailSafe Samba.
The following parameter determines Samba's primary NetBIOS name (the name by which clients can refer to the server):
netbios name = name |
Legal names contain only letters, digits, hyphens, underscores, and periods. They must be 15 characters or fewer in length.
The interfaces parameter allows Samba to support multiple IP interfaces. It takes the following format, where IP is a dotted decimal IP address and netmask is a dotted decimal netmask such as 255.255.255.0:
interfaces = IP1/netmask1 IP2/netmask2 |
The Samba daemons will typically attempt to bind to all interfaces in the system. To force the Samba daemons to only bind to the interfaces specified in the interfaces parameter, you would add the following parameter:
bind interfaces only = yes |
The following parameters specify non-default locations for the password file, log files, and database files:
smb passwd file = password_path log file = log_path lock file = lock_path |
The include parameter allows Samba to include lines from another file as if they had been entered into the sbm.conf file at the location of the include parameter. (In other words, the included file replaces the include parameter line in the smb.conf file.) The value of this parameter can contain macros (characters that are expanded by the Samba daemons based on how the client contacts the daemon).
The macro used by FailSafe Samba is %L, which expands to the NetBIOS name of the server that the client is contacting:
include = /usr/samba/lib/smb.conf.%L |
Using this parameters allows FailSafe Samba to split the smb.conf file into two separate files:
The first file contains the global parameters used by all resources.
The second file contains any global parameters that may need to be different depending on the NetBIOS name of the server as well as the sections that define the shares to be made available to clients.
In order to fail over the Samba resources, separate Samba daemons that are bound to different interfaces are started for each Samba resource. Each of these instances of Samba daemons use a different smb.conf configuration file. The chkconfig variable samba should be off to prevent the system from trying to start Samba on reboot.
![]() | Note: If there is to be a normal instance of Samba running that
is not controlled by FailSafe, the smb.conf file must
contain an interfaces parameter that does not specify
any of the interfaces used by the FailSafe Samba resources and must contain
the following parameter:
|
When FailSafe starts up, the smb.conf file for each Samba resource is constructed dynamically from the following template file:
/usr/samba/lib/smb.conf.template |
This template file must contain the standard Samba global setup for the workgroup, but it must not contain any of the following smb.conf parameters:
smb passwd file
log file
lock dir
netbios name
bind interfaces only
interfaces
These lines in the smb.conf file are automatically added as FailSafe starts the Samba resources and corresponding lines in the smb.conf template file will be ignored. You should not define any nonglobal (share) names in this template file.
A Samba NetBIOS name must be defined for each Samba resource. For example, consider a machine named hans1 with the following characteristics:
A Samba resource name of server1
A filesystem dependency of /fs1
An IP_address resource dependency with an HA-IP of 123.45.6.78 and a netmask of 255.255.255.0
For this system, when FailSafe first brings the resource online it creates the following directories (if they do not already exist):
/fs1/.samba/server1 /fs1/.samba/server1/locks /fs1/.samba/server1/log /fs1/.samba/server1/private |
Next, FailSafe generates the /fs1/.samba/server1/smb.conf configuration file by first copying the contents of the /usr/samba/lib/smb.conf.template file and then appending the following lines to the generated smb.conf file:
smb passwd file = /fs1/.samba/server1/private/smbpasswd log file = /fs1/.samba/server1/log/log.%m lock dir = /fs1/.samba/server1/locks bind interfaces only = yes netbios name = server1 interfaces = 123.45.6.78/255.255.255.0 include=/usr/samba/lib/smb.conf.%L |
The include=/usr/samba/lib/smb.conf.%L line refers to a file that describes the shares that Samba serves out for a specific NetBIOS name. At run time, the %L is expanded into the NetBIOS name that the client is using to refer to the server. As the FailSafe administrator, you must create one of these files for each NetBIOS name and place them in the /usr/samba/lib directory. For this example, you would create a file named /usr/samba/lib/smb.conf.server1 .
The smb.conf file above tells Samba to respond to connection requests on the given IP address under the name server1, and to register that name via broadcast on the given interface.
FailSafe then starts the Samba daemons, specifying that they use the configuration file just created.
Next, consider a second FailSafe node named hans2 with the following characteristics:
a Samba resource name of server2
A filesystem dependency of /fs2
An IP_address resource dependency with an HA-IP of 123.45.6.90 and a netmask of 255.255.255.0
For this system, when FailSafe first brings the resource online it creates the following directories (if they do not already exist):
/fs2/.samba/server2 /fs2/.samba/server2/locks /fs2/.samba/server2/log /fs2/.samba/server2/private |
Next, FailSafe generates the /fs2/.samba/server2/smb.conf configuration file by first copying the contents of the /usr/samba/lib/smb.conf.template file and then appending the following lines to the generated smb.conf file:
smb passwd file = /fs2/.samba/server2/private/smbpasswd log file = /fs2/.samba/server2/log/log.%m lock dir = /fs2/.samba/server2/locks bind interfaces only = yes netbios name = server2 interfaces = 123.45.6.90/255.255.255.0 include=/usr/samba/lib/smb.conf.%L |
FailSafe then starts the Samba daemons, specifying that they use the configuration file just created.
In this example, Windows clients requesting a connection to server1 would access the resources on hans1, and those clients requesting a connection to server2 would access the resources on hans2.
Now, consider what happens when the machine hans2 fails and hans1 must take over the resource. Once hans2 has failed and the /fs2 filesystem and the HA-IP address 123.45.6.90 have been failed over to hans1 , FailSafe will recreate the /fs2/.samba/server2/smb.conf file and another smdb and nmdb daemon will be started. These new daemons will point to the configuration file that was created on /fs2. The Windows clients that now connect to the NetBIOS name server2 will access the machine hans1 instead of hans2, although the change in physical servers will be transparent to them.
![]() | Note: The change in physical servers will not be transparent to clients that had active connections to server message block (SMB) resources on server2. They must drop these resource handles and reconnect. The success of this procedure depends on what operation the Windows clients were performing. |