Section 4.3. Configuration File Options


4.3. Configuration File Options

When one of the Samba daemons is launched, it looks first at any configuration file specified with the -s option or in the default compile-time-defined location (e.g., /usr/local/samba/lib/smb.conf). There are two smb.conf options that allow you either to replace or to extend the current configuration at runtime. These two options, along with the copy directive, which allows you to clone one share in smb.conf into another, are described in Table 4-3.

Table 4-3. Configuration file options

Parameter

Value

Description

Default

Scope

config file

string

Sets the location of a configuration file to use instead of the current one.

None

Global

include

string

Specifies an absolute path to a file that should be read and parsed into the current configuration file.

None

Global

copy

string

Allows you to clone the configuration options of another share in the current share.

None

Share


4.3.1. config file

The global config file option specifies a replacement configuration file that will be loaded when the option is encountered. If the target file exists, the remainder of the current configuration file, as well as the options encountered so far, will be discarded, and Samba configures itself entirely with the options in the new file. Variables can be used with the config file option, which is useful in the event that you want to use a special configuration file based on the NetBIOS machine name or user of the client that is connecting.

For example, the following line instructs Samba to use a configuration file specified by the NetBIOS name of the client connecting, if such a file exists. If it does, options specified in the original configuration file are ignored:

 [global]     config file = /etc/samba/smb.conf.%m 

If the configuration file specified does not exist, the option is ignored, and Samba continues to configure itself based on the current file. This behavior allows a default configuration file to serve most clients, while providing for exceptions with customized configuration files.

4.3.2. include

The fundamental difference between the config file option and the include parameter is that the former completely replaces all existing configuration settings, yet the latter does just as its name implies: it inserts settings from an additional file in the current configuration. Figure 4-1 illustrates how all three options override their previous values. This option also can be used with variables for such purposes as including additional settings that differ for each client machine.

 [global]     include = /usr/local/samba/lib/smb.conf.%m 

If the configuration file specified does not exist, the option is ignored. Options in the include file override any option specified previously, but not options that are specified later. Because the included file is inserted into the main file, beware of including global options into the section for a file or printer share as this will generate an error in the Samba logfiles.

Figure 4-1. The include option in a Samba configuration file


The majority of parameters can be overridden in an included file, but a few cannot. The workgroup and the server string directives are two examples of parameters that cannot be redefined.

4.3.3. copy

The copy configuration option allows you to clone the configuration options of the share name that you specify in the current share. The template share must appear earlier in the configuration file than the share that is performing the copy. For example:

 [basic]     read only    = no     browseable    = yes     available    = no [data]     copy         = basic     available    = yes     path         = /data 

Note that any options in the [data] share defined prior to the copy directive are overridden by those from the [basic] share. However, the top-down parsing of smb.conf allows us to reset these copied values by specifying more options after the copy parameter.




Using Samba
Using Samba: A File and Print Server for Linux, Unix & Mac OS X, 3rd Edition
ISBN: 0596007698
EAN: 2147483647
Year: 2004
Pages: 135

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net