Creating File Shares

File shares begin with the share name in square brackets and continue until the next share definition or until the end of the file. Typically, lines after the share name line are indented, although this isn't required. A fairly basic file share looks like this:

comment = Test share on %L

path = /exports/shared writeable = Yes

This share delivers the contents of/exports/shared under the share name test. (Figure 24.3 shows this share, among others, accessible from TEELA.) Most of these options aren't actually required; they provide extra information to clients (the comment option) or set features of the share (the writeable option). Even the path option can be omitted—the default value is /tmp, except in one special case, described shortly. Table 24.5 summarizes some of the most common file share options.

Table 24.5: Common File Share Samba Options

Option

Value

Meaning

comment

String

A one-line description of the share, which appears in some views of the share from the client.

path

Directory name

The directory to be shared.

browseable

Boolean

Whether or not the share appears in browsers. The default value is Yes.

writeable

Boolean

Whether or not users can write to the share, given the appropriate permissions. The default value is No.

create mask

Octal permission string

The Linux permissions assigned to new files created by clients. (Execute permission bits may be modified by other options, though.)

directory mask

Octal permission string

The Linux permissions assigned to new directories created by clients. (Execute permission bits may be modified by other options, though.)

nt acl support

Boolean

Whether or not to map Linux file ownership and permissions onto Windows NT-style ACLs. The default value is Yes.

force user

Username

An override to the username assigned to new files created by users. Also affects the files the user can read or write.

Note Many Samba options are available with alternative spellings or synonyms. For instance, writeable, writable, and write ok are all synonymous. An antonym for all of these is read only; read only = True is the same aswriteable = False.

Note Many Samba options are available with alternative spellings or synonyms. For instance, writeable, writable, and write ok are all synonymous. An antonym for all of these is read only; read only = True is the same aswriteable = False.

Many Samba file share options affect how Samba handles the translation between Linux ownership, permissions, filenames, and other filesystem details and features that DOS and Windows expect on their filesystems. DOS and Wndows 9x/Me don't support Linux ownership and permissions, so Samba uses create mask and directory mask to set default permissions. Samba uses the username of the individual who mounted the share to set the owner of new files, unless force user overrides that setting. Windows NT, 2000, and XP support ownership and access control lists (ACLs). When such a client connects to Samba, the server maps Linux ownership and permissions onto limited ACLs. If you use an ACL-enabled filesystem, such as XFS, with a recent Samba package, you get better ACL support from your clients.

One special Samba file share comes predefined in many distributions' smb.conf files: [homes]. This share is unusual because it maps to the user's home directory. For instance, if the user buzz has a home directory of /home/buzz, and if this user opens a browser onto the server from a Wndows machine, a [homes] share will appear under the name buzz. If this user opens this share, he'll find files from his home directory available in the share.

Note In order to display a [homes] share with the user's username, the user must have logged into the server. A few non-Wndows SMB/CIFS browsers don't prompt for a password, and hence aren't fully logged in, until after the user selects the share to open. In these browsers, the [homes] share appears by that name, but when the user accesses the share, it opens on the user's home directory.

The [homes] share is unusual in a couple of configuration details. First, it normally includes a browseable = No option, which would ordinarily make the share disappear from browse lists. In the case of [homes], this option makes the share name homes disappear from browse lists, but a share named after the user remains in the browse list. Second, [homes] shares usually lack a path option. Samba knows to map this share to the users' home directories rather than to a fixed location.

0 0

Post a comment