Section 4.2. Special Sections


4.2. Special Sections

Now that you've gotten your feet wet with variables, we will talk about a few special sections of the Samba configuration file. Again, don't worry if you don't understand every configuration option listed here; we go over each of them in the upcoming chapters.[*]

[*] The [IPC$] share is another specialized service used by CIFS clients for interprocess communication. Samba provides this built-in share regardless of the services listed in smb.conf.

4.2.1. The [global] Section

The [global] section appears in virtually every Samba configuration file, even though it is not mandatory. If the section is not present, Samba uses the default values for all global settings. Any option that appears before the first marked section is assumed to be a global option. This means that the [global] section heading is not absolutely required; however, following the rule that it is better to explicitly state what you mean, include it for clarity and to protect your server against changes in default behavior in any future Samba releases.

There are two purposes for the [global] section. Server-wide settings are defined here, and any options that apply to shares will be used as a default in all share definitions, unless overridden within the share definition.

To illustrate this, let's again look at the example at the beginning of the chapter:

 [global]     ## core networking options     netbios name      = RAIN     workgroup         = GARDEN     encrypt passwords = yes     ## netbios name service settings     wins support      = yes     ## logging     log level         = 1     max log size      = 1000     ## default service options     read only         = no [homes]     browseable         = no [test]     comment           = For testing only, please     path              = /export/tmp 

When Samba reads its config file, it creates a special internal service that contains the default values of all parameters. Any service parameters that you define in the [global] section are assigned to this list. When a client connects to the [test] share, Samba first consults the explicit parameter list for that share. Then it looks in the default settings for implicit option assignments. Explicit settings take precedence over any compile-time or [global] defaults. In other words, if the [test] service contained a line that said read only = yes, the share would be marked as read-only regardless of the default or global value the parameter had been assigned.

4.2.2. The [homes] Section

If a client attempts to connect to a share that doesn't appear in the smb.conf file, Samba searches for a [homes] share in the configuration file. If a [homes] share exists, smbd begins a search to validate the share name as a Unix username. If that username appears in the password database (e.g., /etc/passwd) on the server, Samba creates a temporary share bearing the specified username and all the attributes of the [homes] share.

For example, assume that a client system is connecting to the Samba server RAIN for the first time and tries to connect to a share named [alice]. After verifying the user's credentials, smbd searches smb.conf for a share named [alice], but fails to locate one. There is however, a [homes] share, so Samba then attempts to validate the username alice in the server's /etc/passwd (or other account database). If the validation is successful, Samba then creates a share called [alice] for use during the client's session. From this point on, the share [alice] is treated as a normal file share. Any variables are expanded according to the standard rules.

4.2.3. The [printers] Section

We will delay a detailed explanation of Samba's printing features until we get to Chapter 7. For the sake of completeness, however, we will introduce a third built-in section. This section, named [printers], performs a service for system printers analagous to what the [homes] share does for user home directories. If a client attempts to connect to a share that isn't in the smb.conf file and the [homes] check fails (or [homes] is not defined), Samba will check to see whether it is a printer share (assuming that the [printers] has been included). Samba does this by querying the operating system's printing system database to see whether the share name appears there. If it does, Samba creates a share named after the printer.

This behavior means that as with [homes], you don't have to maintain a share for each printer available on the system in your smb.conf file. Instead, Samba honors the Unix printer registry if you ask it to, and provides these printers to the client systems. However, there is a potential difficulty: if you have an account named fred and a printer named fred, Samba will always find the user account first and ignore the existence of the printer, even if the client really needed to connect to the printer, assuming that both [homes] and [printers] sections are defined. We revisit the [printers] section again in Chapter 7.




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