Printing in Linux - CUPS



PRINTING WITH THE COMMON UNIX PRINTING SYSTEM (CUPS)

The main LINUX printing program is the Common UNIX Printing System (CUPS); except that it’s not common to UNIX. There are ports of CUPS available for most common UNIX OS’es. Cups is supported by: Caldera, Conectiva*, Debian, easyLinux*, HP-UX, IRIX, Linux Mandrake*, Peanut*, Red Hat, Solaris, SuSE, Tru64, UNIX, TurboLinux, and AIX.

* use cups as the primary printing system.

Native CUPS sets up the Internet Printing Protocol (IPP, port 631) by default, but also supports JetDirect (port 9100). With the appropriate software installed CUPS also supports Windows printing (SAMBA) and standard UNIX lpr/lpd (cups-lpd, port 515.).

Printing occurs by spooling print to the local /var/spool/print directory and sending to the target printer from there. Unlike Windows, LINUX/CUPS does not enforce print driver selection on the client.

[pic]

lpr/lpd (port 515)

• BSD-style print queue or lpd is server, lpr is the client.

• Most common printing mechanism under UNIX/LINUX.

• Security is an issue - runs as root.Listens on all interfaces.

• Limited to text, postscript or PCL on its own. Can be coupled with Ghostscript to do graphics and support more printers.

• Simple setup in native form. Requires add on (cups-lpd) with CUPS as backend. Default is XINETD application.

• lpr is the least common denominator of standards-based network printing and is widely supported.

• Default print queue name is lp0.

• Uses /etc/princap and “filter” program to generate print stream.

[pic]

JetDirect (port 9100)

• Promoted by HP. Common industry standard supported by most direct LAN attach printers.

• Under Windows known as “TCP/IP Printing” port.

[pic]

CUPS (IPP, port 631)

• Supports Internet Printing Protocol (IPP), port 631 also supported by Microsoft Windows 2000.

• IPP, and CUPS, supports access control, authentication, and encryption over http for configuration, status information on a printer, manage their printers, and manage their jobs using their web browser.

• The cups-drivers package contains drivers for over 1200 printers.

• Command line replacements for the lpr commands are available, but they support more options.

[pic]

Installing and configuring CUPS

• Install all RPMs. Including cups, cups-devel., cups-drivers, cups-lpd

• CUPS install overwrites the old printing system, especially lpr. Must remove any legacy “lpr” package before installing cups-lpd

• rpm –i cups*

• Start the cups service. cups-lpd installs as an XINETD application so modify /etc/xinetd.d/cups-lpd to DISABLE=NO

• Configure by pointing browser to 127.0.0.1:631 or use system-config-printer (gnome).

• Configured/controlled through the /etc/cups/cupsd.conf file.

• Six different configuration files for cups. cupsd.conf is the only one you would normally edit by hand.. cupsd.conf has 69 different directives (see MAN page)

[pic]

Portwalling

• By default, cups/ipp will listen on every interface for print or web interface. To change this.

In cups.conf, comment out the lines:

Port 80

Port 631

Replace them with:

Listen 127.0.0.1:631

Listen lan_ip_address:631

Listen 127.0.0.1:80

Listen lan_ip_address:80

• UDP port 631 is open for browsing. Thes can be turned off by specifying “Browsing off:”, but it may cause problems if you have other cups servers or clients:

Another way to limit access to UDP on port 631, but less secure, is to add the following lines:

BrowseAddress lan_ip_broadcast_address

BrowseAddress 127.0.0.1

BrowseAllow from 127.0.0.1

BrowseAllow from lan_ip_subnet (i.e. 192.168.1.0/24)

BrowseOrder deny,allow

[pic]

Cups and Samba

• CUPS supports Samba printers starting with Samba version 2.06.

To configure Samba for CUPS (windows users can print to a cups server), edit the smb.conf file and replace the existing printing commands and options with the line:

printing = cups

• Versions of Samba older than 2.06 and broken versions of Samba (2.06 and 2.07 have been reported) require the following lines in your smb.conf file:

printing = sysv

printcap name = lpstat

print command = lp -d %p -o raw %s; rm -f %s



• You will also need to add a [printer] section to your smb.conf file. (Otherwise, you are sharing any printers!) Here is a sample:

# NOTE: In CUPS print system there is no need to

# specifically define each individual printer.

# You must configure the Samba printers as "Generic PostScript Printer"

# on your Windows clients.

# If you wish to configure the printers directly on the Windows clients

# (i.e. use the windows drivers on the clients) you must swap the

# 'print command' line below with the commented one.

[printers]

comment = All Printers

path = /var/spool/Samba

browseable = yes

# to allow user 'guest account' to print.

guest ok = yes

writable = no

printable = yes

create mode = 0700

# =====================================

# print command: see above for details.

# =====================================

print command = lpr-cups -P %p -o raw %s # using client side printer drivers.

# print command = lpr-cups -P %p %s # using cups own drivers (use

#generic PostScript on clients).

# lpr -P %p %s

lpq command = lpstat -o %p

lprm command = cancel %p-%j

• To configure CUPS for SAMBA (cups can use printers on windows machines), run the following command:

ln -s `which smbspool` /usr/lib/cups/backend/smb.

[pic]

CUPS and LPR

• Cups has a command line equivalent to the lp and lpr commands with the cups-lpr compatibility package installed. All the commands that worked with the old LPD print system still work exactly the same.

• Cups, however, adds a bunch of new options you can use that are not present in LPD.

• To print to your default printer, use the command: "lpr filename".

• To print to a specific printer, use the command "lpr -P printername filename".

• To print portrait is the default. To print landscape, "lpr -o landscape filename"

• Cups also allows you to specific media size, type and source. The printer must support the options you choose.T

• o use these options, the command is "lpr -o media=option1,option2,etc filename". Multiple options are allowed, and they are not case sensitive. Note there are no spaces in the list!

• If your printer supports duplexing, from the command line the command is "lpr -o duplexingoption filename" where duplexingoption is one of the following:

"sides=two-sided-short-edge" is the option suitable for landscape pages.

"sides=two-sided-long-edge" is the option is suitable for portrait pages.

• The default is to print every page. The "-o page-ranges=pages" option selects a range of pages for printing. "pages" can be a hyphenated range such as 1-4, or a comma separated (no spaces!) list of pages, such as 3,5,6 or both, such as 3,4-6,8.

• Cups allow multiple options to be combined. Simply add another -o to the command. Suppose you wanted to print pages 3-4, and 6 landscape from the file myletter to the printer myprinter:

The command is "lpr -P myprinter -o landscape -o page-ranges=3-4,6 myletter".

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download