The Samba smbconf Configuration File

You configure the Samba daemon using the smb.conf file located in the /etc/samba directory. The file is separated into two basic parts: one for global options and the other for shared services. A shared service, also known as shares, can either be filespace services (used by clients as an extension of their native file systems) or printable services (used by clients to access print services on the host running the server). The filespace service is a directory to which clients are given access; they can use the space in it as an extension of their local file system. A printable service provides access by clients to print services, such as printers managed by the Samba server.

The /etc/samba/smb.conf file holds the configuration for the various shared resources, as well as global options that apply to all resources. Linux installs an smb.conf file in your /etc/samba directory. The file contains default settings used for your distribution. You can edit the file to customize your configuration to your own needs. Many entries are commented with either a semicolon or a # sign, and you can remove the initial comment symbol to make them effective. Instead of editing the file directly, you may want to use the SWAT configuration utility, which provides an easy-to-use, full-screen Web page interface for entering configurations for shared resources. The SWAT configuration utility also provides extensive help features and documentation. For a complete listing of the Samba configuration parameters, check the Man page for smb.conf. An extensive set of sample smb.conf files is located in the /usr/share/doc/samba* directory in the examples subdirectory.

In the smb.conf file, global options are set first, followed by each shared resource's configuration. The basic organizing component of the smb.conf file is called a section. Each resource has its own section that holds its service name and definitions of its attributes. Even global options are placed in a section of their own, labeled global. For example, each section for a filespace share consists of the directory and the access rights allowed to users of the filespace. The section of each share is labeled with the name of the shared resource. Special sections, called printers and homes, provide default descriptions for user directories and printers accessible on the Samba server. Following the special sections, sections are entered for specific services, namely access to specific directories or printers.

A section begins with a section label consisting of the name of the shared resource encased in brackets. Other than the special sections, the section label can be any name you want to give it. Following the section label, on separate lines, different parameters for this service are entered. The parameters define the access rights to be granted to the user of the service. For example, for a directory, you may want it to be browsable, but read-only, and to use a certain printer. Parameters are entered in the format parameter name = value. You can enter a comment by placing a semicolon at the beginning of the comment line.

A simple example of a section configuration follows. The section label is encased in brackets and followed by two parameter entries. The path parameter specifies the directory to which access is allowed. The writeable parameter specifies whether the user has write access to this directory and its filespace.

[mysection] path = /home/chris writeable = true

A printer service has the same format but requires certain other parameters. The path parameter specifies the location of the printer spool directory. The read-only and printable parameters are set to true, indicating the service is read-only and printable. public indicates anyone can access it.

[myprinter]

path = /var/spool/samba read only = true printable = true public = true

Parameter entries are often synonymous but different entries that have the same meaning. For example, read only = no, writeable = yes, and write ok = yes all mean the same thing, providing write access to the user. The public parameter is a synonym for guest ok. SWAT will use guest ok instead of public, and read only in place of writeable.

0 0

Post a comment