6.3 Configuration Options

   

Options in the Samba configuration files fall into one of two categories: global options or share options. Each category dictates where an option can appear in the configuration file.

Global options

Global options must appear in the [global] section and nowhere else. These are options that typically apply to the behavior of the Samba server itself and not to any of its shares.

Share options

Share options can appear in share definitions, the [global] section, or both. If they appear in the [global] section, they will define a default behavior for all shares unless a share overrides the option with a value of its own.

In addition, configuration options can take three kinds of values. They are as follows :

Boolean

These are simply yes or no values, but can be represented by any of the following: yes , no , true , false , 1 , or . The values are case-insensitive: YES is the same as yes .

Numeric

This is a decimal, hexadecimal, or octal number. The standard 0x nn syntax is used for hexadecimal and nnn for octal.

String

This is a string of case-sensitive characters , such as a filename or a username.

6.3.1 Configuration File Options

You can instruct Samba to include or replace configuration options as it is processing them. The options to do this are summarized in Table 6-3.

Table 6-3. Configuration file options

Option

Parameters

Function

Default

Scope

config file

string ( name of file)

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

None

Global

include

string (name of file)

Specifies an additional set of configuration options to be included in the configuration file

None

Global

copy

string (name of share)

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

None

Share

6.3.1.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 will configure 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 = /usr/local/samba/lib/smb.conf.%m 

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

6.3.1.2 include

This option, discussed in greater detail earlier, copies the target file into the current configuration file at the point specified, as shown in Figure 6-1. This option also can be used with variables. You can use this option as follows:

 [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. In Figure 6-1, all three options will override their previous values.

Figure 6-1. The include option in a Samba configuration file
figs/sam2_0601.gif

The include option does not work with the variables %u (user), %P (current share's root directory), or %S (current share's name) because they are not set at the time the include parameter is processed .

6.3.1.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 target share must appear earlier in the configuration file than the share that is performing the copy. For example:

 [template]     writable = yes     browsable = yes     valid users = andy, dave, jay [data]     path = /usr/local/samba     copy = template 

Note that any options in the share that invoked the copy directive will override those in the cloned share; it does not matter whether they appear before or after the copy directive.

   


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

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