Samba Server   «Prev  Next»

Lesson 4Shares, Homes, and Printing
ObjectiveConfigure shares, homes, and printing Option.

Shares, Homes, and Printing

Samba's shared resources are made available through shares. Normally, these shares are simply directories given a unique share name. For example, if you wanted to make the /tmp directory available using Samba, you could give it a share name of "tmp" or "temporary directory", or whatever you wanted.

Configuring shares

Once you know which directories you want to make available, define a share for each of them in /etc/smb.conf. The share name must be enclosed in square brackets ([]) and must be on a line by itself. All the share's configuration options follow the share name. Suppose you wanted to make your Samba server's temporary directory, /tmp, available to all SMB clients. You would first define the share by enclosing the share name, tmp, in square brackets. Next, you would configure share options, such as specifying the path to the shared resource (path = /tmp) or read-only access (read only = yes). Your final share configuration might then look like:

[tmp]
path = /tmp 
read only = yes 
comment = "temporary directory"

Configuring special shares

Samba provides two special shares: [homes] and [printers]. These shares behave differently than other user-defined shares, but provide highly valuable functionality that you will probably want.

[homes]

The [homes] share allows an SMB client to access a specific home directory on the Samba server. When a user logs on, Samba creates a share named for the user. The [homes] share allows an administrator to make home directories available without specifying each directory individually.

[printers]

The [printers] share allows SMB clients to access all printers defined in the /etc/printcap file. Using this share, any printer you've previously configured is immediately accessible to all SMB clients, without having to specify a share for each printer.
The simulation below gives you some practice at configuring a share. You want to make the /projects directory available, as read/write, to all SMB clients. Additionally, you want to provide a descriptive comment for this share, because new users aren't familiar with its contents.
Share Network Drive
Once you have made your changes, reload them by restarting Samba. Red Hat Linux makes this easy; just type service smb restart.
In the next lesson, you will learn how to test a Samba server's configuration.