( lpr -Porca ) | V |---------------------| | lpd | |---------------------| | V ( /var/spool/lpd/orca ) ------------> [orca]
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.
After setting up the printcap file, you can use the checkpc to check for the existance and correct permissions on the entries in the printcap database.
This directory contains the files to be printed and files of
control information. The names of the files are:
lpc>status porky Printer Printing Spooling Jobs Server Subserver Redirect Status/(Debug) porky@brew enabled enabled 0 none none
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:
-b or -l |   | Binary file; don't process it. |
-c |   | cifplot output. |
-d |   | TeX DVI file. |
-g |   | Output from the plot(3X). |
-n or -t: |   | (di)troff output. |
-p |   | Text file that should be pre-processed by the pr command, and then by the standard text filter. |
-r |   | Fortran output |
-v |   | Benson Varian raster image. |
The corresponding filters as specified in the printcap file are:
if | The default f format for all jobs | |
cf |   | Cifplot data filter. |
df |   | Filter for DVI files. |
gf |   | Graph data filter. |
nf |   | Ditroff data filter. |
rf |   | Filter for Fortran style files. |
tf |   | Troff filter. |
vf |   | Versatek raster image filter. |
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.
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:
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:
config_file = /etc/lpd.conf lpd_printcap_path = /etc/printcap logfile = /var/log/lpd perms_path = /etc/lpd.perms
Other common options might be:
default_printer_when_unknown=unknown_printer mc=100 # maximum number of copies allowed lp=/dev/lp # default printer name
/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,
# Reject connections from all IP's except those shown. REJECT SERVICE=X NOT REMOTEIP=168.1.0.0/255.255.0.0 # Control can only be exercised by root ACCEPT SERVICE=C SERVER REMOTEUSER=root # Allow user bozo on server bigtop.clowns.org to control printer P301 ACCEPT SERVICE=C REMOTEHOST=clowns.bigtop.org PRINTER=P301 REMOTEUSER=bozo
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).
panda:\ :ml=0:\ :mx=0:\ :sd=/var/spool/lpd/panda:\ :af=/var/spool/lpd/panda/panda.acct:\ :sh:\ :rm=esus:\ :rp=panda:\ :lpd_bounce=true:\ :if=/usr/share/printconf/util/mf_wrapper:
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:
There are a number of specific directives that can be found in a location to define the access controls to be applied.
The fixed resources are:
/ | The path for all get operations (get-printers, get-jobs, etc.) |
/admin | The path for all administration operations (add-printer, delete-printer, start-printer, etc.) |
/admin/conf | The path for access to the CUPS configuration files (cupsd.conf, client.conf, etc.) |
/classes | The path for all classes |
/classes/name | The resource for class name |
/jobs | The path for all jobs (hold-job, release-job, etc.) |
/jobs/id | The resource for job id |
/printers | The path for all printers |
/printers/name | The path for printer name |
/printers/name.ppd | The PPD file path for printer name |
The most common and needed location access control is for /admin, which specifies who can access the administrative functions.
Accepting | AllowUser | DefaultPrinter |
DenyUser | DeviceURI | Info |
JobSheets | KLimit | Location |
PageLimit | Printer | QuotaPeriod |
State | StateMessage |
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.
The possible job sheet types are:
none | - | Do not produce a banner page. | |
classified | - | A banner page with a "classified" label at the top and bottom. | |
confidential | - | A banner page with a "confidential" label at the top and bottom. | |
secret | - | A banner page with a "secret" label at the top and bottom. | |
standard | - | A banner page with no label at the top and bottom. | |
topsecret | - | A banner page with a "top secret" label at the top and bottom. | |
unclassified | - | A banner page with an "unclassified" label at the top and bottom |
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.
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.
Accepting | AllowUser | DefaultPrinter |
DenyUser | DeviceURI | Info |
JobSheets | KLimit | Location |
PageLimit | Printer | QuotaPeriod |
State | StateMessage |
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.
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.