Red Hat Linux 7 Unleashed

Red Hat Linux 7 Unleashed

By William Ball

Sharing Files and Print Services

After configuring your defaults for the Samba server, you can create specific shared directories limited to certain groups of people or available to everyone. For example, say you want to make a directory available to only one user. To do so, you would create a new section and fill in the needed information. Typically, you'll need to specify the user, directory path, and configuration information to the SMB server, as shown here:

[jacksdir]
comment = Jack's remote source code directory
path = /usr/local/src
valid users = tackett
browseable = yes
public = no
writable = yes
create mode = 0700

This sample section creates a shared directory called jacksdir. It's best to keep share names to under nine characters to avoid warnings in the testparm utility, and to avoid problems on older SMB clients incapable of using longer share names. The path to the directory on the local server is /usr/local/src. Because the browseable entry is set to yes, jacksdir will show up in the client's network browse list (such as Windows Explorer). However, because the public entry is set to no and the valid users entry lists only tackett, only the user tackett can access this directory using Samba. You can grant access to more users and to groups by specifying them (using an at sign prepended to the group name) in the valid users entry. Here's the valid users= line after giving group devel access:

valid users = tackett, @devel

A printer share is created by placing a print ok=yes (or synonym) and a printer name= in the share. Here is an example:

[vals_lp]
print ok = yes
printer name = lp_mine
path = /home/everyone
valid users = valerie, @devel
browseable = yes

Here is a printer that is listed as vals_lp on the client because of the browseable=yes. It prints out of printcap printer lp_mine. Its spool directory is /home/everyone, and valid users are valerie and the devel group.

The primary differences between a printer share like this and the [printers] section is that the [printers] section displays all printcap printers without being browseable, whereas a printer share such as the preceding displays only the printer whose value appears in the printer name= option, and then only if a browseable=yes option appears. The [printers] section does not have or require a printer name= option because its purpose is to display all printers to the client and allow the client access to all printers.

All the same Samba printer troubleshooting tips previously listed in the [printers] section of this chapter apply to printer shares.

Share ThisShare This

Informit Network