The Line Printer Server: LPRng

 < Day Day Up > 



LPRng is an enhanced version of the Berkeley Line Printer Daemon (LPD) lpd and associated lpr applications. It features a wide range of capabilities that include security measures and access to remote printers. Many of the commands are the same as those used by LPD on a standard Unix system. The Linux printer server program is called lpd, the line printer daemon. Printers are installed to run under lpd, which then handles print jobs for them both locally and from remote sources. Though lpd is called the line printer daemon, it is designed to manage any kind of printer, not just line printers. You should think of it as a general-purpose print server capable of handling laser, inkjet, PostScript, and dot-matrix printers. LPRng also features a companion IFHP filter package, which provides hardware-level support for PostScript, PCL, and text printers, among others (see www.astart.com/lprng.html).

The lpd daemon is installed and configured on your Linux system during installation. lpd is run as a standalone process by the lpd startup script in the /etc/rc.d/init.d directory. You can use the service command on this script to start, stop, and restart the daemon:

service lpd restart

The lpd daemon makes use of two configuration files: lpd.conf and lpd.perms. lpd.conf contains general lpd configuration commands. You use lpd.perms to set up rules with which you can restrict access to the lpd server. Here you can deny access by certain hosts, users, or even networks.

Requests to print documents are performed by print clients such as lpr. When a document is submitted for printing, it becomes a print job that is placed on a queue for the printer it was sent to. While the job is on the queue waiting to print, you can check its status and even remove it from the queue, canceling the job. The lpq client lets you check a print queue, lpc allows you to make changes to it, and lprm is used to remove a print job from a queue.

LPRng Print Clients

You can use any of several LPRng print clients to manage the printing jobs on your printer or printers, such as Klpq and several command line print clients like lpr and lpq. Klpq is a KDE desktop utility and is labeled the Print Job Administration tool. With Klpq, you can list the print jobs for a printer, remove a print job, and move a print job to the top of the queue. You can also disable printing for a printer. To have the print queue listing automatically updated, you can set an update frequency in the Options menu.

printcap File

The /etc/printcap file holds entries for each printer connected to your system. A printcap entry holds information, such as the pathname for a printer's spool directory and the device name of the printer port the printer uses. The first field in a printcap entry is a list of possible names for the printer. These are names you can make up yourself, and you can add others if you want. Each name is separated from the next by a | symbol. You use these names to identify the printer when you enter various printer commands or options, such as the -P option. These names are also used for special shell variables, such as the PRINTER variable, used in many initialization scripts.

The fields following the list of names set different fields for your printer. The fields are separated by colons and assigned a value using the = symbol. Three of the more important fields are lp, sd, and of. The lp field is set to the device name the printer uses. The sd field is set to the pathname of the spool directory, and if is set to the particular filter used for this printer. Some fields have Boolean values and simply list the field name with no assignment, which indicates a value of "true." You can find a complete listing of the printcap fields in the printcap Man pages: man printcap. An example of a printcap entry follows:

myprinter|myepson:\         :sh:\         :ml=0:\         :mx=0:\         :sd=/var/spool/lpd/myprinter:\         :lp=/dev/lp0:\         :lpd_bounce=true:\         :if=/usr/share/printconf/mf_wrapper:

To install a remote (network- or remote host–attached) printer, you place remote entries for the printer host and device in the printer's /etc/printcap file entry. An :rm entry identifies the remote host that controls the remote printer, and an :rp entry specifies the device name of the remote printer. In the following example, the remote printer is located at rabbit.mytrek.com and is called lp1:

:rm=rabbit.mytrek.com :rp=lp1

Configuring lpd

LPRng allows you to configure your lpd server, setting global defaults or controlling printer access. There are only two configuration files to manage, and both are heavily commented. Your distribution will normally provide basic versions for both. An extensive set of features are available, letting you create servers with powerful and complex capabilities.

lpd.conf

The general configuration for LPRng, including the lpd print server, is handled in the /etc/lpd.conf file. Here you can specify features that apply to all printers and print management. You should think of these more as default features, as any of them can be overridden in a printer's printcap entry. The lpd.conf file installed with LPRng contains an extensive list of configuration parameters. They are all commented out, prefixed with # signs. Each parameter is preceded by a comment describing the parameter. The entry itself lists the default value given to the parameters, preceding the entry with the term default. The entry for the connect_timeout parameter is shown here:

# Purpose: connection timeout for remote printers # default connect_timeout=10 (INTEGER)

To create your own timeout entry, it is best to add your own entry below, as shown here. Notice that the preceding # and the term default are missing from the new entry. The connection timeout for remote printers is now set at 20. This can be overridden by a printer's printcap file entry.

# Purpose: connection timeout for remote printers # default connect_timeout=10 (INTEGER) connect_timeout=20

Parameters can also be flags that you can turn on or off. An off flag is noted with an attached @ sign. In the following example, the allow_user_logging parameter is a flag that allows users to request login information. By default, it is turned off. The following example turns it on:

# Purpose: allow users to request logging info using lpr -mhost%port # default allow_user_logging@ (FLAG off) allow_user_logging

LPRng Access Controls: lpd.perms

LPRng provides access control rules for controlling how remote users access your print server, and thereby the printers it controls. These rules are placed in the /etc/lpd.perms file and can be used to refuse print services to specific hosts or users. Such rules consist of an action and a set of keys. The keys specify criteria to be met, and if they met, their associated action is taken. In each rule, you have one action and one or more keys. If there are several keys, all their criteria must be met for the action to take place. An example of a key would be to specify the IP address of a host. In addition, you have to specify the kind of service that is being requested, such as a printing or connection request. The action is usually either ACCEPT or REJECT. Keys operate as flags or variables. To specify a host, you assign the address to the HOST key, using an assignment operator. For a user, you use USER, and for IP addresses, IFIP. The kind of service is specified by the SERVICE key. For a printing request, the value you assign is the lpd code P. The following example specifies a host as the key and will REJECT any request from that address:

REJECT SERVICE=P HOST=192.168.0.57

The lpd.perms file consists of a set of rules that are sequentially evaluated until a match is found. The DEFAULT action rule should be the last rule and is normally one to accept any requests. In other words, any request that is not matched by the preceding rules is accepted. Normally, you would set up rules to reject certain requests, such as requests for specific hosts. Most requests would not match these rules and should fall through to the DEFAULT action, which would ACCEPT them.

SERVICE key values differ depending on the type of request submitted. These can range from a simple connection request by a remote server to a removal of a print job. The print clients such as lpr, lpq, lprm, and lpc make different kinds of service requests. lpq makes a request for queue information that has the key value Q for SERVICE. lprm issues a removal request indicated by a key value M.

LPRng Print Clients

LPRng uses the same command line print clients as described for CUPS. These include the lpr, lpc, lpq, and lprm commands. Check the Man pages for each for detailed options. Certain features, like encryption, are available only with CUPS versions.



 < Day Day Up > 



Red Hat(c) The Complete Reference
Red Hat Enterprise Linux & Fedora Edition (DVD): The Complete Reference
ISBN: 0072230754
EAN: 2147483647
Year: 2004
Pages: 328

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net