smb.conf/printers

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search

Usage

This page is based on a transcription of the manpage as of 2010-09-09. It does not, however, need to remain faithful to the original, and may be corrected, reformatted, rearranged, or amended with additional information.

About

This section works like [homes], but for printers.

If a [printers] section occurs in the configuration file, users are able to connect to any printer specified in the local host"s printcap file.

When a connection request is made, the existing sections are scanned. If a match is found, it is used. If no match is found, but a [homes] section exists, it is used as described above. Otherwise, the requested section name is treated as a printer name and the appropriate printcap file is scanned to see if the requested section name is a valid printer share name. If a match is found, a new printer share is created by cloning the [printers] section.

A few modifications are then made to the newly created share:

  • The share name is set to the located printer name
  • If no printer name was given, the printer name is set to the located printer name
  • If the share does not permit guest access and no username was given, the username is set to the located printer name.

The [printers] service MUST be printable – if you specify otherwise, the server will refuse to load the configuration file.

Example

Typically the path specified is that of a world-writeable spool directory with the sticky bit set on it. A typical [printers] entry looks like this:

[printers]
path = /usr/spool/public
guest ok = yes
printable = yes

Aliases

All aliases given for a printer in the printcap file are legitimate printer names as far as the server is concerned. If your printing subsystem doesn´t work like that, you will have to set up a pseudo−printcap. This is a file consisting of one or more lines like this:

alias|alias|alias|alias...

Each alias should be an acceptable printer name for your printing subsystem. In the [global] section, specify the new file as your printcap. The server will only recognize names found in your pseudo−printcap, which of course can contain whatever aliases you like. The same technique could be used simply to limit access to a subset of your local printers.

An alias, by the way, is defined as any component of the first entry of a printcap record. Records are separated by newlines, components (if there are more than one) are separated by vertical bar symbols (|).

SYSV

On SYSV systems which use lpstat to determine what printers are defined on the system you may be able to use printcap name = lpstat to automatically obtain a list of printers. See the printcap name option for more details.