Preface

This software administrators manual provides printer administration information for the Common UNIX Printing SystemTM ("CUPSTM"), version 1.1.15.

Document Overview

This software administrators manual is organized into the following sections:

Notation Conventions

Various font and syntax conventions are used in this guide. Examples and their meanings and uses are explained below:

Example     Description
 
lpstat
lpstat(1)
    The names of commands; the first mention of a command or function in a chapter is followed by a manual page section number.
 
/var
/usr/share/cups/data/testprint.ps
    File and directory names.
 
Request ID is Printer-123     Screen output.
 
lp -d printer filename ENTER     Literal user input; special keys like ENTER are in ALL CAPS.
 
12.3     Numbers in the text are written using the period (.) to indicate the decimal point.

Abbreviations

The following abbreviations are used throughout this manual:

Other References

2 - Building and Installing CUPS

This chapter shows how to build and install the Common UNIX Printing System. If you are installing a binary distribution from the CUPS web site, proceed to the section titled, Installing a Binary Distribution.

Installing a Source Distribution

This section describes how to compile and install CUPS on your system from the source code.

Requirements

You'll need ANSI-compliant C and C++ compilers to build CUPS on your system. As its name implies, CUPS is designed to run on the UNIX operating system, however the CUPS interface library and most of the filters and backends supplied with CUPS should also compile and run under Microsoft Windows.

For the image file filters and PostScript RIP, you'll need the JPEG, PNG, TIFF, and ZLIB libraries. CUPS will build without these, but with significantly reduced functionality. Easy Software Products maintains a mirror of the current versions of these libraries at:

If you make changes to the man pages you'll need GNU groff or another nroff-like package. GNU groff is available from:

The documentation is formatted using the HTMLDOC software. If you need to make changes you can get the HTMLDOC software from:

Finally, you'll need a make program that understands the include directive - FreeBSD, NetBSD, and OpenBSD developers should use the gmake program.

Compiling CUPS

CUPS uses GNU autoconf to configure the makefiles and source code for your system. Type the following command to configure CUPS for your system:

The default installation will put the CUPS software in the /etc, /usr, and /var directories on your system, which will overwrite any existing printing commands on your system. Use the --prefix option to install the CUPS software in another location:

If the PNG, JPEG, TIFF, and ZLIB libraries are not installed in a system default location (typically /usr/include and /usr/lib) you'll need to set the CFLAGS, CXXFLAGS, and LDFLAGS environment variables prior to running configure:

or:

To enable support for encryption, you'll also want to add the "--enable-ssl" option:

SSL and TLS support require the OpenSSL library, available at:

If the OpenSSL headers and libraries are not installed in the standard directories, use the --with-openssl-includes and --with-openssl-libs options:

Once you have configured things, just type:

to build the software.

Installing the Software

Use the "install" target to install the software:

WARNING:

Installing CUPS will overwrite your existing printing system. If you experience difficulties with the CUPS software and need to go back to your old printing system, you will need to reinstall the old printing system from your operating system CDs.

Running the Software

Once you have installed the software you can start the CUPS server by typing:

Installing a Binary Distribution

CUPS comes in a variety of binary distribution formats. Easy Software Products provides binaries in TAR format with installation and removal scripts ("portable" distributions), and in RPM and DPKG formats for Red Hat and Debian-based distributions. Portable distributions are available for all platforms, while the RPM and DPKG distributions are only available for Linux.

WARNING:

Installing CUPS will overwrite your existing printing system. If you experience difficulties with the CUPS software and need to go back to your old printing system, you will need to remove the CUPS software with the provided script and/or reinstall the old printing system from your operating system CDs.

Installing a Portable Distribution

To install the CUPS software from a portable distribution you will need to be logged in as root; doing an su is good enough. Once you are the root user, run the installation script with:

After asking you a few yes/no questions the CUPS software will be installed and the scheduler will be started automatically.

Installing an RPM Distribution

To install the CUPS software from an RPM distribution you will need to be logged in as root; doing an su is good enough. Once you are the root user, run RPM with:

After a short delay the CUPS software will be installed and the scheduler will be started automatically.

Installing an Debian Distribution

To install the CUPS software from a Debian distribution you will need to be logged in as root; doing an su is good enough. Once you are the root user, run dpkg with:

After a short delay the CUPS software will be installed and the scheduler will be started automatically.

3 - Managing Printers

This chapter describes how to add your first printer and how to manage your printers.

The Basics

Each printer queue has a name associated with it; the printer name must start with a letter and can contain up to 127 letters, numbers, and the underscore (_). Case is not significant, e.g. "PRINTER", "Printer", and "printer" are considered to be the same name.

Printer queues also have a device associated with them. The device can be a parallel port, a network interface, and so forth. Devices within CUPS use Uniform Resource Identifiers ("URIs") which are a more general form of Uniform Resource Locators ("URLs") that are used in your web browser. For example, the first parallel port in Linux usually uses a device URI of parallel:/dev/lp1.

You can see a complete list of supported devices by running the lpinfo(8) command:

The -v option specifies that you want a list of available devices. The first word in each line is the type of device (direct, file, network, or serial) and is followed by the device URI or method name for that device. File devices have device URIs of the form file:/directory/filename while network devices use the more familiar method://server or method://server/path format.

Finally, printer queues usually have a PostScript Printer Description ("PPD") file associated with them. PPD files describe the capabilities of each printer, the page sizes supported, etc., and are used for PostScript and non-PostScript printers. CUPS includes PPD files for HP LaserJet, HP DeskJet, EPSON 9-pin, EPSON 24-pin, and EPSON Stylus printers.

Adding Your First Printer

CUPS provides two methods for adding printers: a command-line program called lpadmin(8) and a Web interface. The lpadmin command allows you to perform most printer administration tasks from the command-line and is located in /usr/sbin. The Web interface is located at:

and steps you through printer configuration. If you don't like command-line interfaces, try the Web interface instead.

Adding Your First Printer from the Command-Line

Run the lpadmin command with the -p option to add a printer to CUPS:

For a HP DeskJet printer connected to the parallel port this would look like:

Similarly, a HP LaserJet printer using a JetDirect network interface at IP address 11.22.33.44 would be added with the command:

As you can see, deskjet.ppd and laserjet.ppd are the PPD files for the HP DeskJet and HP LaserJet drivers included with CUPS. You'll find a complete list of PPD files and the printers they will work with in Appendix C, "Printer Drivers".

For a dot matrix printer connected to the serial port this would might look like:

Here you specify the serial port (e.g. S0,S1, d0, d1), baud rate (e.g. 9600, 19200, 38400, 115200, etc.), number of bits, parity, and flow control. If you do not need flow control, delete the "+flow=soft" portion.

Adding Your First Printer from the Web

The CUPS web server provides a user-friendly "wizard" interface for adding your printers. Rather than figuring out which device URI and PPD file to use, you can instead click on the appropriate listings and fill in some simple information. Enter the following URL in your web browser to begin:

Click on the Add Printer button to add a printer.

Managing Printers from the Command-Line

The lpadmin command enables you to perform most printer administration tasks from the command-line. You'll find lpadmin in the /usr/sbin directory.

Adding and Modifying Printers

Run the lpadmin command with the -p option to add or modify a printer:

The options arguments can be any of the following:

Deleting Printers

Run the lpadmin command with the -x option to delete a printer:

Setting the Default Printer

Run the lpadmin command with the -d option to set a default printer:

The default printer can be overridden by the user using the lpoptions(1) command.

Starting and Stopping Printers

The enable and disable commands start and stop printer queues, respectively:

Printers that are disabled may still accept jobs for printing, but won't actually print any files until they are restarted. This is useful if the printer malfunctions and you need time to correct the problem. Any queued jobs are printed after the printer is enabled (started).

Accepting and Rejecting Print Jobs

The accept and reject commands accept and reject print jobs for the named printer, respectively:

As noted above, a printer can be stopped but accepting new print jobs. A printer can also be rejecting new print jobs while it finishes those that have been queued. This is useful for when you must perform maintenance on the printer and will not have it available to users for a long period of time.

Setting Quotas on a Printer

CUPS supports page and size-based quotas for each printer. The quotas are tracked individually for each user, but a single set of limits applies to all users for a partiuclar printer. For example, you can limit every user to 5 pages per day on an expensive printer, but you cannot limit every user except Johnny.

The job-k-limit, job-page-limit, and job-quota-peiod options determine whether and how quotas are enforced for a printer. The job-quota-period option determines the time interval for quota tracking. The interval is expressed in seconds, so a day is 86,400, a week is 604,800 and a month is 2,592,000 seconds. The job-k-limit option specifies the job size limit in killobytes. The job-page-limit option specifies the number of pages limit.

For quotas to be enforced, the period and at least one of the limits must be set to a non-zero value. The following options will enable quotas:

Or, you can combine all three options on the same line.

Restricting User Access to a Printer

The -u option of the lpadmin command controls which users can print to a printer. The default configuration allows all users to print to a printer:

CUPS supports allow and deny lists so that you can specify a list of users who are allowed to print or not allowed to print. Along with your list of users, you can specify whether they are allowed or not allowed to use the printer:

This command allows peter, paul, and mary to print to the named printer, but all other users cannot print. The command:

has the opposite effect. All users except peter, paul, and mary will be able to print to the named printer.

NOTE:

The allow and deny options are not cummulative. That is, you must provide the complete list of users to allow or deny each time.

Also, CUPS only maintains one list of users - the list can allow or deny users from printing. If you specify an allow list and then specify a deny list, the deny list will replace the allow list - only one list is active at any time.

Managing Printers from the Web

The Web interface is located at:

From there you can perform all printer management tasks with a few simple mouse clicks.

4 - Printer Classes

This chapter describes what printer classes are and how to manage them.

The Basics

CUPS provides collections of printers called printer classes. Jobs sent to a class are forwarded to the first available printer in the class. Classes can themselves be members of other classes, so it is possible for you to define very large, distributed printer classes for high-availability printing.

CUPS also supports implicit classes. Implicit classes work just like printer classes, but they are created automatically based upon the available printers and classes on the network. This allows you to setup multiple print servers with identical printer configurations and have the client machines send their print jobs to the first available server. If one or more servers go down, the jobs are automatically redirected to the servers that are running, providing fail-safe printing.

Managing Printer Classes from the Command-Line

Run the lpadmin command with the -p and -c options to add a printer to a class:

The class is created automatically if it doesn't exist. To remove a printer from a class use the -r option:

To remove the entire class just use the -x option:

Managing Printer Classes from the Web Interface

The Web interface is located at:

The Add Class and Modify Class interfaces provide a list of available printers; click on the printers of interest to add them to the class.

Implicit Classes

A noted earlier, implicit classes are created automatically from the available network printers and classes. To disable this functionality, set the ImplicitClasses directive to Off in the cupsd.conf file. You will find more information on doing this in Chapter 6, "Printing System Management".

5 - Client Setup

This chapter discusses several ways to configure CUPS clients for printing.

The Basics

A client is any machine that sends print jobs to another machine for final printing. Clients can also be servers if they communicate directly with any printers of their own.

CUPS supports several methods of configuring client machines:

Manual Configuration of Print Queues

The most tedious method of configuring client machines is to configure each remote queue by hand using the lpadmin command:

The printer name is the name of the printer on the server machine. The server name is the hostname or IP address of the server machine. Repeat the lpadmin command for each remote printer you wish to use.

NOTE:

Manual configuration of print queues is not recommended for large numbers of client machines because of the administration nightmare it creates. For busy networks, consider subnetting groups of clients and polling and relaying printer information instead.

Specifying a Single Server for Printing

CUPS can be configured to run without a local spooler and send all jobs to a single server. However, if that server goes down then all printing will be disabled. Use this configuration only as absolutely needed.

The default server is normally "localhost". To override the default server create a file named /etc/cups/client.conf and add a line reading:

to the file. The server name can be the hostname or IP address of the default server.

The default server can also be customized on a per-user basis. To set a user-specific server create a file named ~/.cupsrc and add a line reading:

to the file. The server name can be the hostname or IP address of the default server.

Automatic Configuration of Print Queues

CUPS supports automatic client configuration of printers on the same subnet. To configure printers on the same subnet, do nothing. Each client should see the available printers within 30 seconds automatically. The printer and class lists are updated automatically as printers and servers are added or removed.

If you want to see printers on other subnets as well, use the BrowsePoll directive as described next.

NOTE:

The BrowseAddress directive enables broadcast traffic from your server. The default configuration braodcasts printer information every 30 seconds. Although this printer information does not use much bandwidth, typically about 80 bytes per printer, it can add up with large numbers of servers and printers.

Use the BrowseInterval and BrowseTimeout directives to tune the amount of data that is added to your network load. In addition, subnets can be used to minimize the amount of traffic that is carried by the "backbone" of your large network.

Specifying Multiple Servers for Printing

If you have CUPS servers on different subnets, then you should configure CUPS to poll those servers. Polling provides the benefits of automatic configuration without significant configuration on the clients, and multiple clients on the same subnet can share the same configuration information.

Polling is enabled by specifying one or more BrowsePoll directives in the /etc/cups/cupsd.conf file. For information on making these changes, see Chapter 6, "Printing System Management".

Multiple BrowsePoll lines can be used to poll multiple CUPS servers. To limit the amount of polling you do from client machines, you can have only one of the clients do the polling and relay that information to the others on the same subnet (described next).

Relaying Printers to Other Clients

When you have clients and servers spread across multiple subnets, the polling method is inefficient. CUPS provides a BrowseRelay directive that enables a single client to relay (broadcast) the polled printer information to the local subnet.

For example, Server A and Server B are on subnet 1 and subnet 2, while the clients are on subnet 3. To provide printers to all of the clients in subnet 3, client C will be configured with the following directives in /etc/cups/cupsd.conf:

The BrowseRelay line specifies a source address and mask. Any browse packets coming from a matching address wil be sent to the given broadcast address. In this case, we want the packets from the local machine (127.0.0.1) relayed to the other clients.

As printers are found using polling, they are relayed from client C to the rest of the clients through a broadcast on subnet 3. The rest of the clients can use the standard cupsd.conf configuration.

The BrowseRelay directive can also be used to relay browsing packets from one network interface to another. For example, if client C in the previous example had network interfaces attaches to both subnet 1 and subnet 2, it could use the BrowseRelay directive exclusively:

Load Balancing and Failsafe Operation

When using server polling or broadcasting, CUPS clients can automatically merge identical printers on multiple servers into a single implicit class queue. Clients assume that printers with the same name on multiple servers are in fact the same printer or type of printer being served by multiple machines.

If you have two printers, LaserJet@ServerA and LaserJet@ServerB, a third implicit class called LaserJet will be created automatically on the client that refers to both printers. If the client also has a local printer with the name LaserJet then an implicit class named AnyLaserJet will be created instead.

The client will alternate between servers and automatically stop sending jobs to a server if it goes down, providing a load-balancing effect and fail-safe operation with automatic switchover.

NOTE:

Note that implicit classes (ImplicitClasses) are enabled by default.

6 - Printing System Management

This chapter shows how you can configure the CUPS server.

The Basics

Several text files are used to configure CUPS. All of the server configuration files are located in the /etc/cups directory:

Restarting the CUPS Server

Once you have made a change to a configuration file you need to restart the CUPS server by sending it a HUP signal or using the supplied initialization script. The CUPS distributions install the script in the init.d directory with the name cups. The location varies based upon the operating system:

Changing the Server Configuration

The /etc/cups/cupsd.conf file contains configuration directives that control how the server functions. Each directive is listed on a line by itself followed by its value. Comments are introduced using the number sign ("#") character at the beginning of a line. Since the server configuration file consists of plain text, you can use your favorite text editor to make changes to it.

Server Directives

The cupsd.conf file contains many directives that determine how the server operates:

AccessLog


Examples

Description

The AccessLog directive sets the name of the access log file. If the filename is not absolute then it is assumed to be relative to the ServerRoot directory. The access log file is stored in "common log format" and can be used by any web access reporting tool to generate a report on CUPS server activity.

The server name can be included in the filename by using %s in the name.

The special name "syslog" can be used to send the access information to the system log instead of a plain file.

The default access log file is /var/log/cups/access_log.

Allow


Examples

Description

The Allow directive specifies a hostname, IP address, or network that is allowed access to the server. Allow directives are cummulative, so multiple Allow directives can be used to allow access for multiple hosts or networks. The /mm notation specifies a CIDR netmask:

mm netmask mm netmask
0 0.0.0.0 8 255.0.0.0
1 128.0.0.0 16 255.255.0.0
2 192.0.0.0 24 255.255.255.0
... ... 32 255.255.255.255

The @LOCAL name will allow access from all local network interfaces, but not remote point-to-point interfaces. The @IF(name) name will allow access from the named interface.

The Allow directive must appear inside a Location directive.

AuthClass


Examples

Description

The AuthClass directive defines what level of authentication is required:

The AuthClass directive must appear inside a Location directive.

AuthGroupName


Examples

Description

The AuthGroupName directive sets the group to use for Group authentication.

The AuthGroupName directive must appear inside a Location directive.

AuthType


Examples

Description

The AuthType directive defines the type of authentication to perform:

When using Basic, Digest, or BasicDigest authentication, clients connecting through the localhost interface can also authenticate using certificates.

The AuthType directive must appear inside a Location directive.

AutoPurgeJobs


Examples

Description

The AutoPurgeJobs directive specifies whether or not to purge completed jobs once they are no longer required for quotas. This option has no effect if quotas are not enabled. The default setting is No.

BrowseAddress


Examples

Description

The BrowseAddress directive specifies an address to send browsing information to. Multiple BrowseAddress directives can be specified to send browsing information to different networks or systems.

The @LOCAL name will broadcast printer information to all local interfaces. The @IF(name) name will broadcast to the named interface.

No browse addresses are set by default.

NOTE:

If you are using HP-UX 10.20 and a subnet that is not 24, 16, or 8 bits, printer browsing (and in fact all broadcast reception) will not work. This problem appears to be fixed in HP-UX 11.0.

BrowseAllow


Examples

Description

The BrowseAllow directive specifies a system or network to accept browse packets from. The default is to accept browse packets from all hosts.

Host and domain name matching require that you enable the HostNameLookups directive.

IP address matching supports exact matches, partial addresses that match networks using netmasks of 255.0.0.0, 255.255.0.0, and 255.255.255.0, or network addresses using the specified netmask or bit count.

The @LOCAL name will allow browse data from all local network interfaces, but not remote point-to-point interfaces. The @IF(name) name will allow browse data from the named interface.

BrowseDeny


Examples

Description

The BrowseDeny directive specifies a system or network to reject browse packets from. The default is to deny browse packets from no hosts.

Host and domain name matching require that you enable the HostNameLookups directive.

IP address matching supports exact matches, partial addresses that match networks using netmasks of 255.0.0.0, 255.255.0.0, and 255.255.255.0, or network addresses using the specified netmask or bit count.

The @LOCAL name will block browse data from all local network interfaces, but not remote point-to-point interfaces. The @IF(name) name will block browse data from the named interface.

BrowseOrder


Examples

Description

The BrowseOrder directive specifies the order of allow/deny processing. The default order is deny,allow:

BrowseInterval


Examples

Description

The BrowseInterval directive specifies the maximum amount of time between browsing updates. Specifying a value of 0 seconds disables outgoing browse updates but allows a server to receive printer information from other hosts.

The BrowseInterval value should always be less than the BrowseTimeout value. Otherwise printers and classes will disappear from client systems between updates.

BrowsePoll


Examples

Description

The BrowsePoll directive polls a server for available printers once every BrowseInterval seconds. Multiple BrowsePoll directives can be specified to poll multiple servers.

If BrowseInterval is set to 0 then the server is polled once every 30 seconds.

BrowsePort


Examples

Description

The BrowsePort directive specifies the UDP port number used for browse packets. The default port number is 631.

NOTE:

You must set the BrowsePort to the same value on all of the systems that you want to see.

BrowseProtocols


Examples

Description

The BrowseProtocols directive specifies the protocols to use when collecting and distributing shared printers on the local network. The default protocol is CUPS, which is a broadcast-based protocol.

NOTE:

When using the SLP protocol, you must have at least one Directory Agent (DA) server on your network. Otherwise the CUPS scheduler (cupsd) will not respond to client requests for several seconds while polling the network.

BrowseRelay


Examples

Description

The BrowseRelay directive specifies source and destination addresses for relaying browsing information from one host or network to another. Multiple BrowseRelay directives can be specified as needed.

BrowseRelay is typically used on systems that bridge multiple subnets using one or more network interfaces. It can also be used to relay printer information from polled servers with the line:

This effectively provides access to printers on a WAN for all clients on the LAN(s).

BrowseShortNames


Examples

Description

The BrowseShortNames directive specifies whether or not short names are used for remote printers when possible. Short names are just the remote printer name, without the server ("printer"). If more than one remote printer is detected with the same name, the printers will have long names ("printer@server1", "printer@server2".)

The default value for this option is Yes.

BrowseTimeout


Examples

Description

The BrowseTimeout directive sets the timeout for printer or class information that is received in browse packets. Once a printer or class times out it is removed from the list of available destinations.

The BrowseTimeout value should always be greater than the BrowseInterval value. Otherwise printers and classes will disappear from client systems between updates.

Browsing


Examples

Description

The Browsing directive controls whether or not network printer browsing is enabled. The default setting is On.

NOTE:

If you are using HP-UX 10.20 and a subnet that is not 24, 16, or 8 bits, printer browsing (and in fact all broadcast reception) will not work. This problem appears to be fixed in HP-UX 11.0.

Classification


Examples

Description

The Classification directive sets the classification level on the server. When this option is set, at least one of the banner pages is forced to the classification level, and the classification is placed on each page of output. The default is no classification level.

ClassifyOverride


Examples

Description

The ClassifyOverride directive specifies whether users can override the default classification level on the server. When the server classification is set, users can change the classification using the job-sheets option and can choose to only print one security banner before or after the job. If the job-sheets option is set to none then the server default classification is used.

The default is to not allow classification overrides.

ConfigFilePerm


Examples

Description

The ConfigFilePerm directive specifies the permissions to use when writing configuration files. The default is 0600.

DataDir


Examples

Description

The DataDir directive sets the directory to use for data files.

DefaultCharset


Examples

Description

The DefaultCharset directive sets the default character set to use for client connections. The default character set is utf-8 but is overridden by the character set for the language specified by the client or the DefaultLanguage directive.

DefaultLanguage


Examples

Description

The DefaultLanguage directive specifies the default language to use for client connections. Setting the default language also sets the default character set if a language localization file exists for it. The default language is "en" for English.

Deny


Examples

Description

The Deny directive specifies a hostname, IP address, or network that is allowed access to the server. Deny directives are cummulative, so multiple Deny directives can be used to allow access for multiple hosts or networks. The /mm notation specifies a CIDR netmask:

mm netmask mm netmask
0 0.0.0.0 8 255.0.0.0
1 128.0.0.0 16 255.255.0.0
2 192.0.0.0 24 255.255.255.0
... ... 32 255.255.255.255

The @LOCAL name will deny access from all local network interfaces, but not remote point-to-point interfaces. The @IF(name) name will deny access from the named interface.

The Deny directive must appear inside a Location directive.

DocumentRoot


Examples

Description

The DocumentRoot directive specifies the location of web content for the HTTP server in CUPS. If an absolute path is not specified then it is assumed to be relative to the ServerRoot directory. The default directory is /usr/share/doc/cups.

Documents are first looked up in a sub-directory for the primary language requested by the client (e.g. /usr/share/doc/cups/fr/...) and then directly under the DocumentRoot directory (e.g. /usr/share/doc/cups/...), so it is possible to localize the web content by providing subdirectories for each language needed.

Encryption


Examples

Description

The Encryption directive must appear instead a Location section and specifies the encryption settings for that location. The default setting is IfRequested for all locations.

ErrorLog


Examples

Description

The ErrorLog directive sets the name of the error log file. If the filename is not absolute then it is assumed to be relative to the ServerRoot directory. The default error log file is /var/log/cups/error_log.

The server name can be included in the filename by using %s in the name.

The special name "syslog" can be used to send the error information to the system log instead of a plain file.

FilterLimit


Examples

Description

The FilterLimit directive sets the maximum cost of all running job filters. It can be used to limit the number of filter programs that are run on a server to minimize disk, memory, and CPU resource problems. A limit of 0 disables filter limiting.

An average print to a non-PostScript printer needs a filter limit of about 200. A PostScript printer needs about half that (100). Setting the limit below these thresholds will effectively limit the scheduler to printing a single job at any time.

The default limit is 0.

FontPath


Examples

Description

The FontPath directive specifies the font path to use when searching for fonts. The default font path is /usr/share/cups/fonts.

Group


Examples

Description

The Group directive specifies the UNIX group that filter and CGI programs run as. The default group is sys, system, or root depending on the operating system.

HideImplicitMembers


Examples

Description

The HideImplicitMembers directive controls whether the individual printers in an implicit class are shown to the user. The default is No.

ImplicitClasses must be enabled for this directive to have any effect.

HostNameLookups


Examples

Description

The HostNameLookups directive controls whether or not CUPS looks up the hostname for connecting clients. The Double setting causes CUPS to verify that the hostname resolved from the address matches one of the addresses returned for that hostname. Double lookups also prevent clients with unregistered addresses from connecting to your server. The default is Off to avoid the potential server performance problems with hostname lookups. Set this option to On or Double only if absolutely required.

ImplicitClasses


Examples

Description

The ImplicitClasses directive controls whether implicit classes are created based upon the available network printers and classes. The default setting is On but is automatically turned Off if Browsing is turned Off.

ImplicitAnyClasses


Examples

Description

The ImplicitAnyClasses directive controls whether implicit classes for local and remote printers are created with the name AnyPrinter. The default setting is Off.

ImplicitClasses must be enabled for this directive to have any effect.

Include


Examples

Description

The Include directive includes the named file in the cupsd.conf file. If no leading path is provided, the file is assumed to be relative to the ServerRoot directory.

KeepAlive


Examples

Description

The KeepAlive directive controls whether or not to support persistent HTTP connections. The default is On.

HTTP/1.1 clients automatically support persistent connections, while HTTP/1.0 clients must specifically request them using the Keep-Alive attribute in the Connection: field of each request.

KeepAliveTimeout


Examples

Description

The KeepAliveTimeout directive controls how long a persistent HTTP connection will remain open after the last request. The default is 60 seconds.

Limit


Examples

Description

The Limit directive groups access control directives for specific types of HTTP requests and must appear inside a Location section. Access can be limited for individual request types (DELETE, GET, HEAD, OPTIONS, POST, PUT, and TRACE) or for all request types (ALL). The request type names are case-sensitive for compatibility with Apache.

LimitExcept


Examples

Description

The LimitExcept directive groups access control directives for specific types of HTTP requests and must appear inside a Location section. Unlike the Limit directive, LimitExcept restricts access for all requests except those listed on the LimitExcept line.

LimitRequestBody


Examples

Description

The LimitRequestBody directive controls the maximum size of print files, IPP requests, and HTML form data in HTTP POST requests. The default limit is 0 which disables the limit check.

Also see the identical MaxRequestSize directive.

Listen


Examples

Description

The Listen directive specifies a network address and port to listen for connections. Multiple Listen directives can be provided to listen on multiple addresses.

The Listen directive is similar to the Port directive but allows you to restrict access to specific interfaces or networks.

Location


Examples

Description

The Location directive specifies access control and authentication options for the specified HTTP resource or path. The Allow, AuthClass, AuthGroupName, AuthType, Deny, Encryption, Limit, LimitExcept, Order, Require, and Satisfy directives may all appear inside a location.

Locations on the Server.
LocationDescription
/The path for all get operations (get-printers, get-jobs, etc.)
/adminThe path for all administration operations (add-printer, delete-printer, start-printer, etc.)
/admin/confThe path for access to the ESP Print Pro configuration files (cupsd.conf, client.conf, etc.)
/classesThe path for all classes
/classes/nameThe resource for class name
/jobsThe path for all jobs (hold-job, release-job, etc.)
/jobs/idThe resource for job id
/printersThe path for all printers
/printers/nameThe path for printer name
/printers/name.ppdThe PPD file path for printer name

Note that more specific resources override the less specific ones. So the directives inside the /printers/name location will override ones from /printers. Directives inside /printers will override ones from /.   None of the directives are inherited. More information can be found in section "Printing System Security".

LogFilePerm


Examples

Description

The LogFilePerm directive specifies the permissions to use when writing configuration files. The default is 0644.

LogLevel


Examples

Description

The LogLevel directive specifies the level of logging for the ErrorLog file. The following values are recognized (each level logs everything under the preceding levels):

MaxClients


Examples

Description

The MaxClients directive controls the maximum number of simultaneous clients that will be allowed by the server. The default is 100 clients.

NOTE:

Since each print job requires a file descriptor for the status pipe, the CUPS server internally limits the MaxClients value to 1/3 of the available file descriptors to avoid possible problems when printing large numbers of jobs.

MaxJobs


Examples

Description

The MaxJobs directive controls the maximum number of jobs that are kept in memory. Once the number of jobs reaches the limit, the oldest completed job is automatically purged from the system to make room for the new one. If all of the known jobs are still pending or active then the new job will be rejected.

Setting the maximum to 0 disables this functionality. The default setting is 0.

MaxJobsPerPrinter


Examples

Description

The MaxJobsPerPrinter directive controls the maximum number of active jobs that are allowed for each printer or class. Once a printer or class reaches the limit, new jobs will be rejected until one of the active jobs is completed, stopped, aborted, or cancelled.

Setting the maximum to 0 disables this functionality. The default setting is 0.

MaxJobsPerUser


Examples

Description

The MaxJobsPerUser directive controls the maximum number of active jobs that are allowed for each user. Once a user reaches the limit, new jobs will be rejected until one of the active jobs is completed, stopped, aborted, or cancelled.

Setting the maximum to 0 disables this functionality. The default setting is 0.

MaxLogSize


Examples

Description

The MaxLogSize directive controls the maximum size of each log file. Once a log file reaches or exceeds the maximum size it is closed and renamed to filename.O. This allows you to rotate the logs automatically. The default size is 1048576 bytes (1MB).

Setting the maximum size to 0 disables log rotation.

MaxRequestSize


Examples

Description

The MaxRequestSize directive controls the maximum size of print files, IPP requests, and HTML form data in HTTP POST requests. The default limit is 0 which disables the limit check.

Also see the identical LimitRequestBody directive.

Order


Examples

Description

The Order directive defines the default access control. The following values are supported:

The Order directive must appear inside a Location directive.

PageLog


Examples

Description

The PageLog directive sets the name of the page log file. If the filename is not absolute then it is assumed to be relative to the ServerRoot directory. The default page log file is /var/log/cups/page_log.

The server name can be included in the filename by using %s in the name.

The special name "syslog" can be used to send the page information to the system log instead of a plain file.

Port


Examples

Description

The Port directive specifies a port to listen on. Multiple Port lines can be specified to listen on multiple ports. The default port is 631.

PreserveJobHistory


Examples

Description

The PreserveJobHistory directive controls whether the history of completed, cancelled, or aborted print jobs is stored on disk.

A value of On (the default) preserves job information until the administrator purges it with the cancel command.

A value of Off removes the job information as soon as each job is completed, cancelled, or aborted.

PreserveJobFiles


Examples

Description

The PreserveJobFiles directive controls whether the document files of completed, cancelled, or aborted print jobs are stored on disk.

A value of On preserves job files until the administrator purges them with the cancel command. Jobs can be restarted (and reprinted) as desired until they are purged.

A value of Off (the default) removes the job files as soon as each job is completed, cancelled, or aborted.

Printcap


Examples

Description

The Printcap directive controls whether or not a printcap file is automatically generated and updated with a list of available printers. If specified with no value, then no printcap file will be generated. The default is to generate a file named /etc/printcap.

When a filename is specified (e.g. /etc/printcap), the printcap file is written whenever a printer is added or removed. The printcap file can then be used by applications that are hardcoded to look at the printcap file for the available printers.

PrintcapFormat


Examples

Description

The PrintcapFormat directive controls the output format of the printcap file. The default is to generate a BSD printcap file.

PrintcapGUI


Example

Description

The PrintcapGUI directive sets the program to use when displaying an option panel from an IRIX application that uses the Impressario print API. The default program is the ESP Print Pro "glpoptions" GUI.

The program must accept the -d option to specify a printer and the -o option to specify one or more options. After allowing the user to select/change options, the program must then write the list of printing options without the -o to the standard output.

RemoteRoot


Examples

Description

The RemoteRoot directive sets the username for unauthenticated root requests from remote hosts. The default username is remroot. Setting RemoteRoot to root effectively disables this security mechanism.

RequestRoot


Examples

Description

The RequestRoot directive sets the directory for incoming IPP requests and HTML forms. If an absolute path is not provided then it is assumed to be relative to the ServerRoot directory. The default request directory is /var/spool/cups.

Require


Examples

Description

The Require directive specifies that authentication is required for the resource. The group keyword specifies that the authenticated user must be a member of one or more of the named groups that follow.

The user keyboard specifies that the authenticated user must be one of the named users that follow.

The valid-user keyword specifies that any authenticated user may access the resource.

The default is to do no authentication. This directive must appear inside a Location directive.

RIPCache


Examples

Description

The RIPCache directive sets the size of the memory cache used by Raster Image Processor ("RIP") filters such as imagetoraster and pstoraster. The size can be suffixed with a "k" for kilobytes, "m" for megabytes, or "g" for gigabytes. The default cache size is "8m", or 8 megabytes.

RunAsUser


Examples

Description

The RunAsUser directive controls whether the scheduler runs as the unpriviledged user account (usually lp). The default is No which leaves the scheduler running as the root user.

Note: Running as a non-priviledged user may prevent LPD and locally connected printers from working due to permission problems. The lpd backend will automatically use a non-priviledged mode that is not 100% compliant with RFC 1179. The parallel, serial, and usb backends will need write access to the corresponding device files.

Satisfy


Examples

Description

The Satisfy directive specifies whether all conditions must be satisfied to allow access to the resource. If set to all, then all authentication and access control conditions must be satified to allow access.

Setting Satisfy to any allows a user to gain access if the authentication or access control requirements are satisfied. For example, you might require authentication for remote access, but allow local access without authentication.

The default is all. This directive must appear inside a Location directive.

ServerAdmin


Examples

Description

The ServerAdmin directive identifies the email address for the administrator on the system. By default the administrator email address is root@server, where server is the server name.

ServerBin


Examples

Description

The ServerBin directive sets the directory for server-run executables. If an absolute path is not provided then it is assumed to be relative to the ServerRoot directory. The default executable directory is /usr/lib/cups.

ServerCertificate


Examples

Description

The ServerCertificate directive specifies the location of the SSL certificate file used by the server when negotiating encrypted connections. The certificate must not be encrypted (password protected) since the scheduler normally runs in the background and will be unable to ask for a password. The default certificate file is /etc/cups/ssl/server.crt.

ServerKey


Examples

Description

The ServerKey directive specifies the location of the SSL private key file used by the server when negotiating encrypted connections. The default key file is /etc/cups/ssl/server.crt.

ServerName


Examples

Description

The ServerName directive specifies the hostname that is reported to clients. By default the server name is the hostname.

ServerRoot


Examples

Description

The ServerRoot directive specifies the absolute path to the server configuration and state files. It is also used to resolve relative paths in the cupsd.conf file. The default server directory is /etc/cups.

SSLListen


Examples

Description

The SSLListen directive specifies a network address and port to listen for secure connections. Multiple SSLListen directives can be provided to listen on multiple addresses.

The SSLListen directive is similar to the SSLPort directive but allows you to restrict access to specific interfaces or networks.

SSLPort


Examples

Description

The SSLPort directive specifies a port to listen on for secure connections. Multiple SSLPort lines can be specified to listen on multiple ports.

SystemGroup


Examples

Description

The SystemGroup directive specifies the system administration group for System authentication. More information can be found later in this chapter in "Printing System Security".

TempDir


Examples

Description

The TempDir directive specifies an absolute path for the directory to use for temporary files. The default directory is /var/tmp.

Temporary directories must be world-writable and should have the "sticky" permission bit enabled so that other users cannot delete filter temporary files. The following commands will create an appropriate temporary directory called /foo/bar/tmp:

Timeout


Examples

Description

The Timeout directive controls the amount of time to wait before an active HTTP or IPP request times out. The default timeout is 300 seconds.

User


Examples

Description

The User directive specifies the UNIX user that filter and CGI programs run as. The default user is lp.

Printing System Security

CUPS provides support for address, certificate, and password (Basic and Digest) based authentication and access control. Certificate and password authentication provide ways to limit access to individual people or groups.

Address based access control allows you to limit access to specific systems, networks, or domains. While this does not provide authentication, it does allow you to limit the potential users of your system efficiently.

CUPS maintains a list of locations that have access control and/or authentication enabled. Locations are specified using the Location directive:

Locations generally follow the directory structure of the DocumentRoot directory, however CUPS does have several virtual locations for administration, classes, jobs, and printers:

Location Description
/admin The path for all administration operations.
/classes The path for all classes.
/classes/name The resource for class name.
/jobs The path for all jobs.
/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.

Authentication Using Certificates

CUPS supports a local certificate-based authentication scheme that can be used in place of Basic or Digest authentication by clients connecting through the localhost interface. Certificate authentication is not supported or allowed from clients on any other interface.

Certificates are 128-bit random numbers that refer to an internal authentication record in the server. A client connecting via the localhost interface sends a request with an authorization header of:

The server then looks up the local certificate and authenticates using the username associated with it.

Certificates are generated by the server automatically and stored in the /etc/cups/certs directory using the process ID of the CGI program started by the server. Certificate files are only readable by the User and Group defined in the cupsd.conf file. When the CGI program ends the certificate is removed and invalidated automatically.

The special file /etc/cups/certs/0 defines the root certificate which can be used by any client running as the super-user or another user that is part of the group defined by the SystemGroup directive. The root certificate is automatically regenerated every 5 minutes.

Using Basic Authentication

Basic authentication uses UNIX users and passwords to authenticate access to resources such as printers and classes, and to limit access to administrative functions.

NOTE:

Basic authentication sends the username and password Base64 encoded from the client to the server, so it offers no protection against eavesdropping. This means that a malicious user can monitor network packets and discover valid users and passwords that could result in a serious compromise in network security. Use Basic authentication with extreme care.

The CUPS implementation of Basic authentication does not allow access through user accounts without a password. If you try to authenticate using an account without a password, your access will be immediately blocked.

Once a valid username and password is authenticated by CUPS, any additional group membership requirements are checked.

NOTE:

The root user is considered by CUPS to be a member of every group.

Use the AuthType directive to enable Basic authentication:

Using Digest Authentication

Digest authentication uses users and passwords defined in the /etc/cups/passwd.md5 file to authenticate access to resources such as printers and classes, and to limit access to administrative functions.

NOTE:

Unlike Basic authentication, Digest passes the MD5 sum (basically a complicated checksum) of the username and password instead of the strings themselves. Also, Digest authentication does not use the UNIX password file, so if an attacker does discover the original password it is less likely to result in a serious security problem so long as you use a different UNIX password than the corresponding Digest password.

The current CUPS implementation of Digest authentication uses the client's hostname or IP address for the "nonce" value. The nonce value is an additional string added to the username and password to make guessing the password more difficult. The server checks that the nonce value matches the client's hostname or address and rejects the MD5 sum if it doesn't. Future versions of CUPS will support Digest "session" authentication which adds the request data to the MD5 sum, providing even better authentication and security.

Digest authentication does not guarantee that an attacker cannot gain unauthorized access, but it is safer than Basic authentication and should be used in place of Basic authentication whenever possible. Support for Digest authentication in web browsers is not yet universally available.

The lppasswd(1) command is used to add, change, or remove accounts from the passwd.md5 file. To add a user to the default system group, type:

Once added, a user can change his/her password by typing:

To remove a user from the password file, type:

Once a valid username and password is authenticated by CUPS, any additional group membership requirements are checked.

NOTE:

The root user is considered by CUPS to be a member of every group.

Use the AuthType directive to enable Digest authentication:

System and Group Authentication

The AuthClass directive controls the level of authentication to perform. System and Group authentication extend the normal user-based authentication to require membership in a UNIX group. For System authentication each user must belong to the sys, system, or root group; the actual group depends on the operating system.

For Group authentication each user must belong to the group named by the AuthGroupName directive:

The named group must be a valid UNIX user group, usually defined in the /etc/group or /etc/netgroup files. Additionally, when using Digest authentication you need to create user accounts with the named group:

Printer Accounting

CUPS maintains a log of all accesses, errors, and pages that are printed. The log files are normally stored in the /var/log/cups directory. You can change this by editing the /etc/cups/cupsd.conf configuration file.

The access_log File

The access_log file lists each HTTP resource that is accessed by a web browser or CUPS/IPP client. Each line is in the so-called "Common Log Format" used by many web servers and web reporting tools:

The host field will normally only be an IP address unless you have enabled the HostNameLookups directive in the cupsd.conf file.

The group field always contains "-" in CUPS.

The user field is the authenticated username of the requesting user. If no username and password is supplied for the request then this field contains "-".

The date-time field is the date and time of the request in local time and is in the format:

where ZZZZ is the timezone offset in hours and minutes from Greenwich Mean Time (a.k.a. GMT a.k.a. ZULU.)

The method field is the HTTP method used ("GET", "PUT", "POST", etc.)

The resource field is the filename of the requested resource.

The version field is the HTTP specification version used by the client. For CUPS clients this will always be "HTTP/1.1".

The status field contains the HTTP result status of the request. Usually it is "200", but other HTTP status codes are possible. For example, 401 is the "unauthorized access" status in the example above.

The bytes field contains the number of bytes in the request. For POST requests the bytes field contains the number of bytes that was received from the client.

The error_log File

The error_log file lists messages from the scheduler (errors, warnings, etc.):

The level field contains the type of message:

The date-time field contains the date and time of when the page started printing. The format of this field is identical to the data-time field in the access_log file.

The message fields contains a free-form textual message.

The page_log File

The page_log file lists each page that is sent to a printer. Each line contains the following information:

The printer field contains the name of the printer that printed the page. If you send a job to a printer class, this field will contain the name of the printer that was assigned the job.

The user field contains the name of the user (the IPP requesting-user-name attribute) that submitted this file for printing.

The job-id field contains the job number of the page being printed. Job numbers are reset to 1 whenever the CUPS server is started, so don't depend on this number being unique!

The date-time field contains the date and time of when the page started printing. The format of this field is identical to the data-time field in the access_log file.

The page-number and num-pages fields contain the page number and number of copies being printed of that page. For printer that can not produce copies on their own, the num-pages field will always be 1.

The job-billing field contains a copy of the job-billing attribute provided with the IPP create-job or print-job requests or "-" if none was provided.

File Typing and Filtering

CUPS provides a MIME-based file typing and filtering mechanism to convert files to a printable format for each printer. On startup the CUPS server reads MIME database files from the /etc/cups directory (or a directory specified by the ServerRoot directive) to build a file type and conversion database in memory. These database files are plain ASCII text and can be edited with your favorite text editor.

The mime.types and mime.convs files define the standard file types and filters that are available on the system.

mime.types

The mime.types file defines the known file types. Each line of the file starts with the MIME type and may be followed by one or more file type recognition rules. For example, the text/html file type is defined as:

The first two rules say that any file with an extension of .html or .htm is a HTML file. The third rule says that any file whose first 1024 characters are printable text and starts with the strings <HTML> or <!DOCTYPE is a HTML file as well.

The first two rules deal solely with the name of the file being typed. This is useful when the original filename is known, however for print files the server doesn't have a filename to work with. The third rule takes care of this possibility and automatically figures out the file type based upon the contents of the file instead.

The available tests are:

All numeric values can be in decimal (123), octal (0123), or hexadecimal (0x123) as desired.

Strings can be in quotes, all by themselves, as a string of hexadecimal values, or some combination:

As shown in the text/html example, rules can continue on multiple lines using the backslash (\) character. A more complex example is the image/jpeg rules:

This rule states that any file with an extension of .jpeg, .jpg, or .jpe is a JPEG file. In addition, any file starting with the hexadecimal string <FFD8FF> (JPEG Start-Of-Image) followed by a character between and including 0xe0 and 0xef (JPEG APPn markers) is also a JPEG file.

mime.convs

The mime.convs file defines all of the filter programs that are known to the system. Each line consists of:

The source field is a MIME type, optionally using a wildcard for the super-type or sub-type (e.g. "text/plain", "image/*", "*/postscript").

The destination field is a MIME type defined in the mime.types file.

The cost field defines a relative cost for the filtering operation from 1 to 100. The cost is used to choose between two different sets of filters when converting a file. For example, to convert from image/jpeg to application/vnd.cups-raster, you could use the imagetops and pstoraster filters for a total cost of 100, or the imagetoraster filter for a total cost of 50.

The program field defines the filter program to run; the special program "-" can be used to make two file types equivalent. The program must accept the standard filter arguments and environment variables described in the CUPS Interface Design Description and CUPS Software Programmers Manual:

If specified, the filename argument defines a file to read when filtering, otherwise the filter must read from the standard input. All filtered output must go to the standard output.

Adding Filetypes and Filters

Adding a new file type or filter is fairly straight-forward. Rather than adding the new type and filter to the mime.types and mime.convs files which are overwritten when you upgrade to a new version of CUPS, you simple need to create new files with .types and .convs extensions in the /etc/cups directory. We recommend that you use the product or format name, e.g.:

If you are providing a filter for a common file format or printer, add the company or author name:

This will help to prevent name collisions if you install many different file types and filters.

Once you choose the names for these files, create them using your favorite text editor as described earlier in this chapter. Once you have created the files, restart the cupsd process as described earlier in "Restarting the CUPS Server".

Printer Drivers and PPD Files

Most CUPS printer drivers utilize one or more printer-specific filters and a PPD file for each printer model. Printer driver filters are registered via the PPD file using cupsFilter attributes:

The filter is specified using the source file type only; the destination file type is assumed to be printer/name - suitable for sending to the printer.

Writing Your Own Filter or Printer Driver

CUPS supports an unlimited number of file formats and filters, and can handle any printer. If you'd like to write a filter or printer driver for your favorite file format or printer, consult the CUPS Software Programmers Manual for step-by-step instructions.

7 - Printing with Other Systems

This chapter describes how to print from client systems that use the LPD, Mac OS, or Windows printing protocols.

The Basics

CUPS is based on the IPP protocol, so any system that supports IPP can send jobs to and receive jobs from CUPS automatically. However, not all systems support IPP yet. This chapter will show you how to connect these systems to your CUPS server, either to accept jobs from your server for printing, or to send jobs to your server.

Printing from LPD Clients

CUPS supports limited functionality for LPD-based clients. With LPD you can print files to specific printers, list the queue status, and so forth. However, the automatic client configuration and printer options are not supported by the LPD protocol, so you must manually configure each client for the printers it needs to access.

The cups-lpd(8) program provides support for LPD clients and can be used from either the inetd(8) or xinetd(8) programs. Add the following line to the /etc/inetd.conf file to enable LPD support on your server through the inetd program:

The path to the cups-lpd may vary depending on your installation.

Once you have added this line, send the inetd process a HUP signal or reboot the system:

If you are using the xinetd program, create a file named /etc/xinetd.d/printer containing the following lines:

The xinetd program automatically reads the new configuration file and enables LPD printing support.

Warning:

cups-lpd currently does not perform any access control based on the settings in cupsd.conf or in the hosts.allow or hosts.deny files used by TCP wrappers. Therefore, running cups-lpd on your server will allow any computer on your network (and perhaps the entire Internet) to print to your server.

While xinetd has built-in access control support, you should use the TCP wrappers package with inetd to limit access to only those computers that should be able to print through your server.

Printing to LPD Servers

CUPS provides the lpd backend for printing to LPD-based servers and printers. Use a device URI of lpd://server/name to print to a printer on an LPD server, where server is the hostname or IP address of the server and name is the queue name.

Microsoft Windows NT provides an LPD service under the name "TCP/IP Printing Services". To enable LPD printing on NT, open the "Services" control panel, select the "TCP/IP Printing Services" service, and click on the "Start" button. Any shared printer will then be available via the LPD protocol.

Printing from Mac OS Clients

CUPS does not provide Mac OS support directly. However, there are several free and commercial software packages that do.

Columbia Appletalk Package (CAP)

Because the CAP LaserWriter server (lwsrv(8)) does not support specification of PPD files, we do not recommend that you use CAP with CUPS. However, you can run the lpsrv program for limited printing with the command:

where Name is the name you want to use when sharing the printer, and printer is the name of the CUPS print queue.

XINET KA/Spool

To use your system as a print server for Mac OS clients, configure each printer using a papserver(8) in the /usr/adm/appletalk/services file, specifying the corresponding PPD file in the /etc/cups/ppd directory for each printer. For a printer named MyPrinter the entry would look like:

NOTE:

Enter the text above on a single line without the backslash (\) character.

NetATalk

To use your system as a print server for Mac OS clients, configure each printer in the papd.conf file, specifying the corresponding PPD file in the /etc/cups/ppd directory for each printer. For a printer named MyPrinter the entry would look like:

Printing to Mac OS Servers

CUPS currently does not provide a backend to communicate with a Mac OS server. However, you can write and install a short shell script in the /usr/lib/cups/backend directory that sends a print file using the appropriate command. The following is a short script that will run the papif command provided with CAP.

After copying this script to /usr/lib/cups/backend/cap, specify a device URI of cap://server/printer to use this backend with a print queue.

Printing from Windows Clients

While CUPS does not provide Windows support directly, the free SAMBA software package does. SAMBA version 2.0.6 is the first release of SAMBA that supports CUPS. You can download SAMBA from:

To configure SAMBA for CUPS, edit the smb.conf file and replace the existing printing commands and options with the line:

That's all there is to it! Remote users will now be able to browse and print to printers on your system.

Exporting Printer Drivers

You can optionally export printer drivers from your CUPS server using the cupsaddsmb command and the SAMBA 2.2.0 or higher software.

Before you can export the printers you must download the current Adobe PostScript printer drivers from the Adobe web site (http://www.adobe.com/). Use the free unzip software to extract the files from the self-extracting ZIP file containing the drivers; you will need the following files:

Copy these files to the /usr/share/cups/drivers directory - you may need to rename some of the files so the filenames are all UPPERCASE.

Next, add a print$ share for the printer drivers to your smb.conf file:

The directory for your printer drivers can be anywhere on the system; just make sure it is writable by the users specified by the write list directive. Also, make sure that you have SAMBA passwords defined for each user in the write list using the smbpasswd(1) command. Otherwise you will not be able to authenticate

Finally, run the cupsaddsmb command to export the printer drivers for one or more queues:

Running cupsaddsmb with the -a option will export all printers:

Printing to Windows Servers

CUPS can print to Windows servers in one of two ways. The first way uses the LPD protocol on the CUPS system and the "TCP/IP Printing Services" on the Windows system. You can find out more about this configuration in the LPD section earlier in this chapter.

The second way is through the Microsoft Server Message Block ("SMB") protocol. Support for this protocol is provided with the free SAMBA software package. You can download SAMBA from:

To configure CUPS for SAMBA, run the following command:

The smbspool(1) program is provided with SAMBA starting with SAMBA 2.0.6. Once you have made the link you can configure your printers with one of the following device URIs:

The workgroup name need only be specified if your system is using a different workgroup. The user:pass strings are required when printing to Windows NT servers or to shares with passwords enabled under Windows 95 and 98.

A - Software License Agreement

B - Common Network Settings

This appendix covers many of the popular TCP/IP network interfaces and printer servers available on the market today.

Configuring a Network Interface

When you first install a network printer or print server on your LAN, you need to set the Internet Protocol ("IP") address. On most higher-end "workgroup" printers, you can set the address through the printer control panel. However, in most cases you will want to assign the addresses remotely from your workstation. This makes administration a bit easier and avoids assigning duplicate addresses accidentally.

To setup your printer or print server for remote address assignment, you'll need the Ethernet Media Access Control ("MAC") address, also sometimes called a node address, and the IP address you want to use for the device. The Ethernet MAC address can often be found on the printer test page or bottom of the print server.

Configuring the IP Address Using ARP

The easiest way to set the IP address of a network device is to use the arp(8) command. The arp sends an Address Resolution Protocol ("ARP") packet to the specified Ethernet MAC address, setting the network device's IP address:

Configuring the IP Address Using RARP

The most flexible way to remotely assign IP addresses under UNIX is through the Reverse Address Resolution Protocol ("RARP"). RARP allows a network device to request an IP address using its Ethernet MAC address, and one or more RARP servers on the network will respond with an ARP packet with the IP address the device can use.

RARP should be used when you have to manage many printers or print servers, or when you have a network device that does not remember its IP address after a power cycle. If you just have a single printer or print server, the arp command is the way to go.

Some UNIX operating systems use a program called rarpd(8) to manage RARP. Others, like Linux, support this protocol in the kernel. For systems that provide the rarpd program you will need to start it before RARP lookups will work:

Under IRIX you can enable this functionality by default using:

Both the rarpd program and kernel RARP support read a list of Ethernet and IP addresses from the file /etc/ethers. Each line contains the Ethernet address (colon delimited) followed by an IP address or hostname like:

Add a line to this file and cycle the power on the printer or print server to set its address.

Configuring the IP Address Using BOOTP

The BOOTP protocol is used when you need to provide additional information such as the location of a configuration file to the network interface. Using the standard bootpd(8) program supplied with UNIX you simply need to add a line to the /etc/bootptab file; for IRIX:

Newer versions of bootpd use a different format:

The myprinter.boot file resides in the /usr/local/boot directory by default. If you do not need to provide a boot file you may leave the last part of the line blank.

NOTE:

Some versions of UNIX do not enable the BOOTP service by default. The /etc/inetd.conf usually contains a line for the BOOTP service that can be uncommented if needed.

Verifying the Printer Connection

To test that the IP address has been successfully assigned and that the printer is properly connected to your LAN, type:

If the connection is working properly you will see something like:

If not, verify that the printer or print server is connected to the LAN, it is powered on, the LAN cabling is good, and the IP address is set correctly. You can usually see the current IP address and network status by printing a configuration or test page on the device.

Common Network Interface Settings

Once you have set the IP address you can access the printer or print server using the ipp, lpd, or socket backends. The following is a list of common network interfaces and printer servers and the settings you should use with CUPS:

Model/Manufacturer Device URI(s)
Apple LaserWriter lpd://address/PASSTHRU
Axis w/o IPP
(see directions)
socket://address:9100
socket://address:9101
socket://address:9102
Axis w/IPP ipp://address/LPT1
ipp://address/LPT2
ipp://address/COM1
Castelle LANpressTM lpd://address/pr1
lpd://address/pr2
lpd://address/pr3
DPI NETPrint lpd://address/pr1
lpd://address/pr2
lpd://address/pr3
EFI® Fiery® RIP lpd://address/print
EPSON® Multiprotocol Ethernet Interface Board socket://address
Extended System ExtendNET lpd://address/pr1
lpd://address/pr2
lpd://address/pr3
Hewlett Packard JetDirect w/o IPP socket://address:9100
socket://address:9101
socket://address:9102
Hewlett Packard JetDirect w/IPP ipp://address/ipp
ipp://address/ipp/port1
ipp://address/ipp/port2
ipp://address/ipp/port3
Intel® NetportExpress XL, PRO/100 lpd://address/LPT1_PASSTHRU
lpd://address/LPT2_PASSTHRU
lpd://address/COM1_PASSTHRU
LexmarkTM MarkNet lpd://address/ps
Linksys EtherFast®
(see directions)
socket://address:4010
socket://address:4020
socket://address:4030
Kodak® lpd://address/ps
QMS® CrownNetTM lpd://address/ps
Tektronix® PhaserShareTM socket://address:9100
XEROX® 4512 NIC lpd://address/PORT1
XEROX® XNIC lpd://address/PASSTHRU
XEROX® (most others) socket://address:5503

Configuring Axis Print Servers

The Axis print servers can be configured using ARP, RARP, or BOOTP. However, on models that do not provide IPP support an additional step must be performed to configure the TCP/IP portion of the print server for use with CUPS.

Each print server contains a configuration file named config that contains a list of network parameters used by the server. To modify this file you must first download it from the print server using the ftp(1) program:

Next, edit the file with your favorite text editor and locate the lines beginning with:

Change the RTN_OPT line to read:

This disables the Reverse TELNET protocol and enables the standard TELNET protocol on the print server. Next, assign a port number for each parallel and serial port on the server as follows:

This essentially makes the Axis print server look like a Hewlett Packard JetDirect EX print server. Save the file and then upload the new config file using the ftp command:

Your Axis print server is now ready for use!

Configuring Linksys Print Servers

The Linksys print servers can be configured using ARP, RARP, or BOOTP. Like older Axis print servers, an additional step must be performed to configure the TCP/IP portion of the print server for use with CUPS.

Each print server contains a configuration file named CONFIG that contains a list of network parameters used by the server. To modify this file you must first download it from the print server using the ftp(1) program:

Next, edit the file with your favorite text editor and locate the lines beginning with:

Change the port number for each parallel and serial port on the server as follows:

This maps each virtual printer with a physical port. Save the file and then upload the new CONFIG file using the ftp command:

Your Linksys print server is now ready for use!

C - Printer Drivers

This appendix lists the printer drivers that are provided with CUPS.

Printer Drivers

CUPS includes the following printer drivers:

EPSON 9-pin Dot Matrix

The EPSON 9-pin Dot Matrix driver (epson9.ppd) supports 9-pin dot matrix printers that implement the ESC/P command set. It provides 60x72, 120x72, and 240x72 DPI output in black only.

EPSON 24-pin Dot Matrix

The EPSON 24-pin Dot Matrix driver (epson9.ppd) supports 24-pin dot matrix printers that implement the ESC/P command set. It provides 120x180, 180x180, 360x180, and 360x360 DPI output in black only.

EPSON Stylus Color

The EPSON Stylus Color driver (stcolor.ppd) supports EPSON Stylus Color printers that implement the ESC/P2 command set. It provides 180, 360, and 720 DPI output in black and color (CMYK).

EPSON Stylus Photo

The EPSON Stylus Photo driver (stphoto.ppd) supports EPSON Stylus Photo printers that implement the ESC/P2 command set. It provides 180, 360, and 720 DPI output in black and color (CMYKcm).

HP DeskJet

The HP DeskJet driver (deskjet.ppd) supports HP DeskJet printers that implement the PCL command set. It provides 150, 300, and 600 DPI output in black and color (CMYK).

The DeskJet printers that implement the HP-PPA command set (720C, 722C, 820C, and 1100C) are not supported due to a complete lack of documentation and support from Hewlett Packard.

The duplexer provided with the HP DeskJet 900 series printers is also not supported for similar reasons.

HP LaserJet

The HP LaserJet driver (laserjet.ppd) supports HP LaserJet printers that implement the PCL command set. It provides 150, 300, and 600 DPI output in black only and supports the duplexer if installed.

LaserJet printers that do not implement PCL (3100, 3150) are not supported due to a complete lack of documentation and support from Hewlett Packard.

D - List of Files

This appendix lists the files and directories that are installed for the Common UNIX Printing System.

Pathname Description
/etc/cups/certs/ The location of authentication certificate files for local HTTP clients.
/etc/cups/classes.conf The printer classes configuration file for the scheduler.
/etc/cups/cupsd.conf The scheduler configuration file.
/etc/cups/interfaces/ The location of System V interface scripts for printers.
/etc/cups/mime.convs The list of standard file filters included with CUPS.
/etc/cups/mime.types The list of recognized file types for CUPS.
/etc/cups/ppd/ The location of PostScript Printer Description ("PPD") files for printers.
/etc/cups/printers.conf The printer configuration file for the scheduler.
/usr/bin/cancel The System V cancel job(s) command.
/usr/bin/disable The System V disable printer command.
/usr/bin/enable The System V enable printer command.
/usr/bin/lp The System V print command.
/usr/bin/lpoptions Sets user-defined printing options and defaults.
/usr/bin/lppasswd Adds, changes, or removes Digest password accounts.
/usr/bin/lpq The Berkeley status command.
/usr/bin/lpr The Berkeley print command.
/usr/bin/lprm The Berkeley cancel job(s) command.
/usr/bin/lpstat The System V status command.
/usr/include/cups/ CUPS API header files.
/usr/lib32/libcups.a
/usr/lib32/libcupsimage.a
Static libraries (IRIX 6.5)
/usr/lib/libcups.a
/usr/lib/libcupsimage.a
Static libraries (all others)
/usr/lib/libcups.sl.2
/usr/lib/libcupsimage.sl.2
Shared libraries (HP-UX)
/usr/lib32/libcups.so.2
/usr/lib32/libcupsimage.so.2
Shared libraries (IRIX 6.5)
/usr/lib/libcups.so.2
/usr/lib/libcupsimage.so.2
Shared libraries (all others)
/usr/lib/cups/backend/ Backends for various types of printer connections.
/usr/lib/cups/cgi-bin/ CGI programs for the scheduler.
/usr/lib/cups/daemon/ Daemons for polling and LPD support.
/usr/lib/cups/filter/ Filters for various types of files.
/usr/lib/locale/ The location of language-specific message files. (System V)
/usr/lib/nls/msg/ The location of language-specific message files. (Compaq Tru64 UNIX)
/usr/share/locale/ The location of language-specific message files. (Linux, *BSD)
/usr/sbin/accept The accept-jobs command.
/usr/sbin/cupsd The CUPS print scheduler.
/usr/sbin/lpadmin The System V printer administration tool.
/usr/sbin/lpc The Berkeley printer administration tool.
/usr/sbin/lpinfo The get-devices and get-ppds command.
/usr/sbin/lpmove The move-jobs command.
/usr/sbin/reject The reject-jobs command.
/usr/share/catman/a_man/
/usr/share/catman/u_man/
Man pages (IRIX)
/usr/share/man/ Man pages (Compaq Tru64 UNIX, HP-UX, Solaris)
/usr/man/ Man pages (all others)
/usr/share/cups/data/ The location of filter data files.
/usr/share/cups/data/testprint.ps The PostScript test page file.
/usr/share/cups/fonts/ The location of PostScript fonts for the PostScript RIP.
/usr/share/cups/model/ The location of PostScript Printer Description ("PPD") files and interface scripts that may be used to setup a printer queue.
/usr/share/cups/pstoraster/ Other PostScript RIP initialization files.
/usr/share/cups/pstoraster/Fontmap The font mapping file (converts filenames to fontnames)
/usr/share/cups/templates/ The location of HTML template files for the web interfaces.
/usr/share/doc/cups/ Documentation and web page data for the scheduler.
/var/log/cups/ The location of scheduler log files.
/var/spool/cups/ The location of print files waiting to be printed.

E - Troubleshooting Common Problems

This appendix covers some of the common problems first-time users encounter when installing and configuring CUPS.

Commercial support for CUPS is available from Easy Software Products. For more information please contact us at:

My Applications Don't See the Available Printers

Many applications read the /etc/printcap file to get a list of available printers.

The default CUPS configuration does not create the /etc/printcap file automatically. To enable automatic creation and updating of this file, use the Printcap directive described in Chapter 6, "Printing System Management".

CUPS Doesn't Recognize My Username or Password!

CUPS will ask you for a UNIX username and password when you perform printer administration tasks remotely or via a web browser. The default configuration requires that you use the root username and the corresponding password to authenticate the request.

CUPS does not allow you to authenticate an administration request with an account that has no password for security reasons. If you do not have a password on your root account then you won't be able to add printers remotely or via the web interface!

To disable password authentication you need to edit the /etc/cups/cupsd.conf file and comment out the lines reading:

for the /admin location. Then restart the CUPS server as described in Chapter 6, "Printing System Management".

NOTE:

Disabling password checks will allow any local user to change your printer and class configuration, but remote administration from another machine will still not be allowed.

I Can't Do Administration Tasks from Another Machine!

The default CUPS configuration limits administration to the local machine. To open up access, edit the /etc/cups/cupsd.conf and comment out the lines reading:

for the /admin location. Then restart the CUPS server as described in Chapter 6, "Printing System Management".

NOTE:

Allowing administration access from all hosts is a potential security risk. Please read Chapter 6, "Printing System Management" for a description of these risks and ways to minimize them.

I Can't Do Administration Tasks from My Web Browser!

This problem is usually caused by:

  1. not specifying the correct password for the root account.
  2. accessing the CUPS server using the hostname or IP address of the server without enabling remote access for administration functions. This can be corrected by following the instructions in the "I Can't Do Administration Tasks from Another Machine!" section earlier in this appendix.
  3. not setting a password on the root account. CUPS will not authenticate a user account that does not have a password for security reasons.
  4. authenticating using an account other than root, but the account you are using is not a member of the system group.
  5. configuring CUPS to use Digest authentication, but your web browser does not support Digest authentication.

Connection Refused Messages

Under normal circumstances, "connection refused" messages for a networked printer should be expected from time to time. Most network interfaces only allow a single connection to be made at any given time (one job at a time) and will refuse access to all other systems while the first connection is active. CUPS automatically retries the connection once every 30 seconds.

If the problem persists and you are unable to print any jobs to the printer, verify that another machine is not maintaining a connection with the printer, and that you have selected the proper port or printer name for the printer.

Also, most external print servers will refuse connections if the connected printer is turned off or is off-line. Verify that the affected printer is turned on and is online.

Write Error Messages

If you get "write error" messages on a printer queue the printer interface (usually a Hewlett Packard JetDirect interface) has timed out and reset the network connection from your workstation.

The error is caused by that startup delay between the initial setup of the printer or plotter and the first page of print data that is sent.

To correct the problem, change the idle timeout on the interface to at least 180 seconds or 3 minutes. To change the timeout on a Hewlett Packard JetDirect interface, type: