Understanding the CUPS Configuration Files
You can learn a lot about the CUPS configuration files by examining the entries in various configuration files that the printer configuration tool creates when you set up a new print queue. The CUPS configuration files are in the /etc/cups directory.
Consider the example of adding a new print queue named Office-ES640 for an Epson Stylus Color 640 printer that is connected to the parallel port of the PC. Here are the files that contain information about this print queue and the printer model:
♦ /etc/printcap: This file used to be the printer capabilities database and was very important to the LPD print spooler that was popular before CUPS came along (not that I miss LPD; CUPS is much better). CUPS generates single entry in the /etc/printcap file for each printer. For example, here is the /etc/printcap file that CUPS generates for a print queue named Office-ES600 (the details of the printer are in the /etc/cups/printers.conf file):
# This file was automatically generated by cupsd(8) from the
# /etc/cups/printers.conf file. All changes to this file
# will be lost.
♦ /etc/cups/printers.conf: This is the printer configuration file with entries for each print queue. The information includes the device where the printer is connected and other parameters of the queue. Here is the entry for the Epson Stylus Color 640 printer (that redhat-config-printer in the second line is a reference to the old name of the system-config-printer tool):
Info Created by redhat-config-printer 0.6.x
Location Epson Stylus Color 640 - Front Office
JobSheets none none
♦ /etc/cups/cupsd.conf: This is the configuration file for cupsd, the CUPS print scheduler. The syntax of the configuration file is similar to that of Apache httpd, the Web server (see Chapter 14 for a description of Apache httpd configuration). The similarities with the Apache httpd configuration files are to be expected because cupsd is also an HTTP server. Here are the entries in /etc/cups/cupsd.conf for the print queue named 0ffice-ES600:
# Lines below are automatically generated - DO NOT EDIT
Deny From All
Allow From 127.0.0.1
BrowseAllow from @LOCAL
There are many more directives in the /etc/cups/cupsd.conf file that apply to all print queues managed by the cupsd server.
♦ /etc/cups/lpoptions: This file stores the default option settings that apply to all print jobs when you create a print queue as root. Note that users can specify other options when they print with the lp commands. Here is the /etc/cups/lpoptions file with the default options for the Office-ES600 printer:
Dest Office-ES640 page-bottom=86 cpi=12 page-right=57 page-left=57 page-top=72 scaling=100 lpi=7 wrap=true
♦ /etc/cups/ppd: This is a directory that contains the PostScript Printer Description (PPD) file for the Epson Stylus Color 600 printer in a file named Office-ES600.ppd (the name I had assigned to that print queue). Each PPD file is a text file containing information about the printer capability (similar to the old /etc/printcap file in intent, but PPD files have much more detailed information). Here are the first few lines from the PPD file /etc/cups/ppd/Office-ES640.ppd:
*% For information on using this, and to obtain the required backend
*% script, consult http://www.linuxprinting.org/ *%
*% This file is published under the GNU General Public License
*Product: "(Stylus Color 640)"
Epson Stylus Epson S. Co. Epson Stylus
*cupsFilter: *%pprRIP: *ModelName: *ShortNickName: *NickName: (recommended)" *PSVersion: *PSVersion: *PSVersion: *PSVersion: *PSVersion: *PSVersion: *PSVersion: *LanguageLevel: *ColorDevice: *DefaultColorSpace: RGB *FileSystem: False *Throughput: "1" *LandscapeOrientation: Plus90 *TTRasterizer: Type42
application/vnd.cups-postscript 0 foomatic-rip" foomatic-rip other
Color 640" 640 gimp-print-ijs" Color 640 Foomatic/gimp-print-ijs
(3010.000) (3010.000) (3010.000) (3010.000) (3010.000) (3010.000) (3010.000) 3" True
550" 651" 652" 653" 704" 705" 800"
*HWMargins: 9 9 9 0 *VariablePaperSize: True *MaxMediaWidth: 100000 *MaxMediaHeight: 100000 many lines deleted ...
That should give you an idea of the kind of information stored in PPD files. You don't have to understand or prepare the PPD files manually. CUPS generates the PPD file automatically from descriptions in the Foomatic printer drivers that come with Linux (described later in this chapter).
As this example shows, for each print queue it manages, CUPS needs a considerable amount of information stored in multiple configuration files. So far, I have shown you only the configuration files affected by the definition of a new print queue. It's helpful to know the full extent of the configuration files, understand their purpose, and have a rough idea of what each of these files contain.
CUPS relies on a large number of configuration files to provide a comprehensive printing solution for Linux. Although you do not have to manually edit these configuration files, be aware of what these files are and where they are stored. The key configuration files are located in the /etc/cups directory and its subdirectories. Here is a brief summary of the configuration files:
• /etc/cups/cupsd.conf: The CUPS HTTP server configuration file, used by cupsd, the CUPS scheduler, and the IPP server process. The directives in this file are similar to those used by the Apache httpd (Web server). This means that if you know how to read an Apache httpd configuration file, you can also read and understand cupsd.conf. In particular, cupsd.conf defines access control for a printer in the same way that Apache httpd defines access control for a directory.
• /etc/cups/printers.conf: Defines all available print queues. Information about each printer is in a <Printer PrinterName> ... </Printer> block. A <DefaultPrinter> tag identifies the default printer.
• /etc/cups/classes.conf: Contains definitions of all printer classes. A printer class is a collection of printers. Print jobs sent to a class are forwarded to the first available printer in the class.
• /etc/cups/mime.types: Lists the supported MIME types, such as text/plain and application/postscript, and the rules for automatically detecting the format of a file. (MIME stands for Multipurpose Internet Mail Extensions, which began life as a way to send attachments in a single message file.) The cupsd server uses these rules to determine the type of a file.
• /etc/cups/mime.convs: Contains the MIME conversion rules to convert a file into a format acceptable to a printer. The conversion is achieved by using filters. Each filter has a relative cost associated with it, and the filtering algorithm selects the set of filters that will convert the file to the needed format with the lowest total cost.
• /etc/cups/ppd: A directory with the PostScript Printer Description (PPD) files for the printers being managed by CUPS. These PPD files describe the capabilities of all printers, not just PostScript printers. There is one PPD file for each printer. A PPD file for a non-PostScript printer identifies a filter with the cupsFilter attribute. CUPS uses that filter to convert a file into a form suitable for sending to the printer. For example, the cupsFilter attribute for an Epson Stylus Color 640 printer identifies foomatic-rip as the filter, like this:
*cupsFilter: "application/vnd.cups-postscript 0 foomatic-rip"
The foomatic-rip filter is located in the / usr/lib/cups/filter directory.
• /etc/cups/client.conf: Specifies the default options for clients (in particular, the default server name and whether encryption is to be used or not). Note that a client is any machine that sends print jobs to another machine for final printing. This means that when your system prints to a local printer, it's a client to the cupsd scheduler running on your system.
Continue reading here: Summary
Was this article helpful?