Home Menu

Printer Administration


Contents



Spooling Mysteries

Printing Commands

There are some GUI printing tools, such as gpr that can be installed for a more user-friendly interface if you're in to that sort of thing.


Defining Printers


The Print Daemon

/var/spool/lpd/printername


Printer Management


Print Filters

You are all familiar with filters, since a filter is roughly defined as a program that reads standard input, does something to the data and sends the output to standard output. In the case of printing, the lpd and LPRng subsystems allow filters to be applied to print jobs. In general, these filters are designed to take the incoming format and process it into a different form.

There are two filtering stages in printing - input or IF and output or OF. Input filters are designed to get the input file into a form that can be printed on a particlar printer. Output filters take care of things like printing banner and separation pages.

When printing starts, lpd starts the of filter first. It sends any printer start commands and then sends any banner or separation data sent by lpd.

The input filters are based on historical file types and have the following classifications which are passed through lpr options:

The corresponding filters as specified in the printcap file are:

The filters are typically located in /usr/libexec/filters, /usr/share/printconf, or in the standard executable locations.

Many of the modern systems rely on the magicfilter system which has a database of most current printers and their printing characteristics. lpd will send the input file to magicfilter along with configuration information to have it process the data.


LPRng

LPRng is a new generation line printer system that is installed by default on most new Linux systems. In fact, it is difficult to even get result lpd anymore. In general there is no indication that this is done, as lpr, lpd, lpc and other commands are simply replaced. Under LPRng, there are a wide variety of options in printer configuration that are not available under the traditional system, and of course, more things to worry about. There are two configuration files in addition to /etc/printcap:

lpd.conf

lpd.conf consists of lines that configure the various options. Normally, when a system is installed, the file has all of the options commented out. The option list is quite large:

LPRng Option List

and you may (or may not) want to enable some options and specify the necessary parameters.

In the lpd.conf file, there are a series of escape sequences that have special meaning:

%h     the short form of the host name
%H     the long form of the host name
%a     the abbreviated architecture name
%P     the printer name from printcap
%R     the remote printer name from printcap
%M     the remote host name from printcap

For example on the host hickory.dickory.com with a remote printer named mice on host clock.dickory.com where it is named twelve:
%h   =   hickory
%H   =   hickory.dickory.com
%a   =   arch=linux
%P   =   mice
%R   =   clock.dickory.com
%M   =   twelve

Rather than going into laborious detail on every option, the general categories of the options are:

A minimal lpd.conf file would specify other file locations, such as:

Other common options might be:

/etc/lpd.perms

The lpd.perms file controls access to the LPRng facilities. When a request is made, LPRng searches the perms file for a rule that applies and then takes either the ACCEPT or REJECT action. The first rule that is found is used.

The records in lpd.perms specify an action, a service and the parameters for the match. For example,


Printer Management Tools

There are a number of printer management tools that will lead you through printer setup. Red Hat Linux supports printtool which is a simple GUI that allows you to define a printer and configure the printcap entries based on printer type. Before 7.1, Red Hat used a similar program called printconf. Note that a non-root user can run printtool if you don't set the permissions, but it won't modify /etc/printcap. Also, more recently Red Hat has introduced yet another name for this printconf-gui or even redhat-config-printer-gui. They are all printtool, but at some point, they might start deprecating some of these names (or inventing new ones).

printtool can configure either traditional printing systems or LPRng. There are numerous warnings for printtool that tell you not to change /etc/printcap directly, but instead, put any printers you want to define outside of printtool in /etc/printcap.local. When you restart lpd, it will copy the definitions in printcap.local into printcap. Remember that with printtool, you are configuring LPRng, so you will need to setup the configuration files appropriately.

If you use printtool, you might find an entry like this in /etc/printcap for a Unix printer (a printer on another Unix system).


CUPS - Common Unix Printing System

One of the newest and most elaborate printing systems for Unix is CUPS, which is an open source effort to provide printing utilities similar to those in Windows. This is actually a large task, because with Windows, you have a driver for every printer that handles the printing tasks. Since Unix/Linux tries to avoid such nonsense, it has to provide general purpose tools and a large database of printer definitions. Its pretty good, but still has a few holes. Basically, most printers are pretty similar, but the oddball printers make it difficult to do things in a general way.

Being powerful, CUPS is considerably more complex than lpd or even LPRng. cupsd is the line printer daemon for CUPS and it is configured and controlled primarily by the files in /etc/cups. This includes:

cupsd.conf    Server configuration file
printers.conf    Printer configuration
classes.conf    Local printer class defines
client.conf    Set up a remote CUPS server

cupsd.conf has over 80 directives that can be contained therein, which is more than we really need to know. Some of the ones you are most likely to use are:

The most common and needed location access control is for /admin, which specifies who can access the administrative functions.

printers.conf is the equivalent of the printcap file. This file can contain the following directives for each printer.

Accepting indicates if the printer is active and can accept jobs.

AllowUser indicates users allowed to use the printer.

DefaultPrinter defines the default printer

DenyUser indicates users not allowed to use the printer.

DeviceURI defines the printer device-uri designator.

Info defines the string for the printer information command.

JobSheets defines the job sheets to use at the beginning and end of a job.

The possible job sheet types are:

KLimit defines the job limit for a printer.

Location defines the location string for the printer information.

PageLimit defines the maximum job print size in pages.

Printer defines a printer.

defines the quota period or time over which a quota is applied in seconds.

State defines the printer state as idle or stopped.

StateMessage defines the printer information message for a printer state.

Example printers.conf file:"

classes.conf is used to name a collection of printers. Jobs sent to the printer class are queued and sent to the first available printer in that class. The classes.conf file accepts the same statements as the printers.conf file and they apply to the entire class in the same way.

Example classes.conf file:"

client.conf is used to configure a client CUPS host; one that uses another host to provide printing service. It is a simple file that specifies the name of the server and the encryption method to be used. A host can be a CUPS server as well as being a client.

Example client.conf file:"

One of the best parts about CUPS are the tools for performing configuration. There is a text tool, lpadmin that allows printers to be configured and deleted. The man page explains this quite well.

The other interface to CUPS is through a web browser. You can access your local CUPS configuration through the cupsd process which you can reach through the url http://127.0.0.1:631. Remember that you may have to open up that port in iptables/ipchains in order for it to work.

When you attempt to perform administration functions, you will be required to logon, and you will have to give a user name that is allowed to perform administration according to the /admin configuration. By default, this is a user in the sys group unless you change it in the configuration file. You can add/delete/modify printers and classes, and perform operational administration on print queues as needed. This interface is documented at www.cups.org, but it is very easy to use. One interesting section is that where you can configure your printers. You will see that a fairly sizeable number of options are available for most printers, which is an improvement over traditional Unix/Linux printing.

If you don't use the web administration interface, the tool for creating, deleting and configuring printers is lpadmin.

There are still some applications that don't recognize cups printing, but the list is rapidly getting smaller.


Assignment

  1. Set up a printer. If you already have one setup, study the printcap entry and make sure you understand it. If possible, set up a remote printer to see how that works.
  2. Use lpc to start and stop a queue.  Also, try moving a job to the top of the job queue and clean a queue once just for fun.
  3. Use lpc to stop your printer and then print a file. Go to /var/spool/lpd/?? and look at the files in the spool directory for the printer to see what's there.
  4. Study the documentation on LPRng.

Home Menu