Section 4.5. Disk Share Configuration


4.5. Disk Share Configuration

So far we have not defined the [data] share on our server. So the next step is to create the directory tree on disk that will be exported, as well as the share section in smb.conf to make it accessible to clients.

Samba requires that the directory path being shared actually exist in order for clients to connect it. Otherwise the client will receive an error message about a "bad network path." So if this is a new share with no preexisting files, we must create the path first. The second of the following commands sets the permissions to allow anyone to create files and directories, but the sticky bit prevents a user from deleting another user's files.

 root# mkdir -p /export/smb/data root# chmod 1777 /export/smb/data 

The service details in smb.conf resemble the [test] share we created in Chapter 2:

 [data]     path = /export/smb/data     comment = Data Drive     read only = no 

The [data] share is typical for a Samba disk share. The share maps to the directory /export/smb/data on the Samba server. We've also provided a comment that describes the share as a Data Drive.

Samba's default is to create a read-only share. As a result, the read only option must be explicitly disabled for each disk share that is intended to be writable. Of course, we could define read only = no in the [global] section as the runtime default.

Now, if we connect to the PIGEON server again by double-clicking its icon in the Windows Network Neighborhood, we will see a single file share entitled data, as shown in Figure 4-4. This share has read/write access, so files can be copied to or from it.

Figure 4-4. The initial data share on PIGEON


4.5.1. Disk Share Configuration Options

Table 4-5 lists the basic Samba configuration options previously introduced for disk shares.

Table 4-5. Basic share configuration options

Parameter

Value

Description

Default

Scope

path (directory)

string

Specifies the Unix directory that will be provided for a disk share or used for spooling by a printer share.

/tmp

Share

comment

string

Sets the comment that appears with the share.

None

Share

volume

string

Sets the MS-DOS volume name for the share.

None

Share

read only

boolean

Controls whether clients should be allowed to write the share.

yes

Share

writable (write ok, writeable)

boolean

Inverse of read only. That is, read only = no is the same as writable = yes.

no

Share


4.5.1.1. path

This option, which has the synonym directory, indicates the absolute pathname for the root of the shared directory or printer. You can choose any directory on the Samba server. If the connected user is unable to change to the directory due to a lack of appropriate permissions or because it does not exist, Samba refuses the user's connection request.

4.5.1.2. comment

The comment option allows you to enter a free-form string that is transmitted to the client when it attempts to browse the share. A user can see the comment by using the Details view on the share folder or with the net view command at a Windows command prompt. For example, here is how you might insert a comment for a share:

 [network]     comment = Software installation drive (I:)     path = /export/smb/software 

Be sure not to confuse the comment option, which documents a Samba server's shares, with the global server string option, which documents the server itself.

4.5.1.3. volume

This option allows you to specify the volume name of the share, which would otherwise default to the name of the share given in the smb.conf file.

Some software installation programs check the volume name of the distribution CD-ROM to make sure that the correct CD-ROM is in the drive before attempting to install from it. If you copy the contents of the CD-ROM into a network share and wish to install from there, you can use this option to make sure the installation program sees the correct volume name:

 [software]     comment = Software installation drive (I:)     path = /export/smb/software     volume = ASVP-102-RTYUIKA 

4.5.1.4. read only, writable

The options read only and writable (also called writeable or write ok) are inverse Boolean options. Both default to enforcing read-only behavior on a file share but in a logically opposite fashion. If you want to be able to write data to a share, you must explicitly specify one of the following options in the configuration file for each share:

 read only = no writable = yes 

Samba treats both parameters as the same feature. If you specify more than one occurrence of either or both options, Samba adheres to the last value it encounters for the share.




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

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