6.5 Disk Share Configuration

   

We mentioned in the previous section that there were no disk shares on the toltec server. Let's continue building the configuration file and create an empty disk share called [data] . Here are the additions that will do it:

 [data]     path = /export/samba/data     comment = Data Drive     volume = Sample-Data-Drive     writable = yes 

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

Samba's default is to create a read-only share. As a result, the writable option needs to be explicitly set for each disk share you wish to make writable.

We will also need to create the /export/samba/data directory on the Samba server with the following commands:

 #  mkdir /export/samba/data  #  chmod 777 /export/samba/data  

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

Figure 6-4. The initial data share on the Samba server
figs/sam2_0604.gif

6.5.1 Disk Share Configuration Options

The basic Samba configuration options for disk shares previously introduced are listed in Table 6-5.

Table 6-5. Basic share configuration options

Option

Parameters

Function

Default

Scope

path (directory)

string (directory name)

Sets 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.

Share name

Share

read only

boolean

If yes , allows read-only access to a share.

yes

Share

writable (write ok or writeable )

boolean

If no , allows read-only access to a share. If yes , both reading and writing are allowed.

no

Share

6.5.1.1 path

This option, which has the synonym directory , indicates the pathname for the root of the shared directory or printer. You can choose any directory on the Samba server, so long as the owner of the Samba process that is connecting has read and write access to that directory. If the path is for a printing share, it should point to a temporary directory where files can be written on the server before being spooled to the target printer ( /tmp and /var/spool are popular choices). If this path is for a disk share, the contents of the folder representing the share name on the client will match the contents of the directory on the Samba server.

The directory specified as the value for path can be given as a relative path, in which case it will be relative to the directory specified by the root directory parameter. Because root directory defaults to root ( / ), it is generally a good idea to use absolute paths for the path parameter, unless root directory has been set to something other than the default.

6.5.1.2 comment

The comment option allows you to enter a comment that will be sent to the client when it attempts to browse the share. The user can see the comment by using the Details view on the share folder or with the net view command at an MS-DOS prompt. For example, here is how you might insert a comment for a share:

 [network]     comment = Network Drive     path = /export/samba/network 

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

6.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 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:

 [network]     comment = Network Drive     volume = ASVP-102-RTYUIKA     path = /home/samba/network 
6.5.1.4 read only, writable

The options read only and writable (also called writeable or write ok ) are really two ways of saying the same thing, but they are approached from opposite ends. For example, you can set either of the following options in the [global] section or in an individual share:

 read only = yes writable = no 

If either option is set as shown, data can be read from a share, but cannot be written to it. You might think you would need this option only if you were creating a read-only share. However, note that this read-only behavior is the default action for shares; 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 

If you specify more than one occurrence of either option, Samba will adhere 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: 2003
Pages: 475

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