Section 9.6. I Can t Remember Which Printer to Use


9.6. I Can't Remember Which Printer to Use

Administrators of large networks commonly have to work with a substantial number of printers. Busy offices may have several printers in a dedicated location. As an administrator, you could randomly assign one of the printers as a default for different workstations in the area. In this section, I'll present a more robust solution.

Fortunately, most Linux distributions now use CUPS to administer printers. Developed by Easy Software Products, the standard version of CUPS (http://www.cups.org) is open source and works well with the Foomatic printer driver database available from http://www.linuxprinting.org.

If you want commercial support for CUPS, support and software with additional drivers and administrative tools are available from Easy Software Products at http://www.easysw.com.


When you install CUPS on your system, you get access to a web-browser-based tool that can help you administer the printers on your network. If you're administering multiple printers, CUPS allows you to organize them into groups. When you print to one group, CUPS directs the print job to the first available printer in the group.

Many Linux distributions include their own printer configuration tools that work with CUPS. However, if you want to configure printers in groups, you'll want to use the CUPS command-line tools or web-based interface.

9.6.1. Installing CUPS

Installing the CUPS service and associated printer driver database is a straightforward process. It may already be installed on your system. There are a number of different CUPS packages. As different distributions configure each package differently, all I can provide are general guidelines:


Package names starting with cups

The main CUPS services have RPM and DEB package names that start with cups. The names may vary. Debian's CUPS server package is cupsys; SUSE and Red Hat use cups. Other packages in this category may include drivers, clients, and configuration tools.


Package names starting with foomatic*

Open source printer databases are available as the Foomatic database from http://www.linuxprinting.org.


Package names starting with libcups*

Driver libraries are often configured in libcups* packages.

These are general descriptions. For more information on packages associated with a specific distribution, use the search feature available for that distribution, such as:

  • The Red Hat Network for RHEL packages

  • SUSE's YaST Online Update

  • The yum search cups | less command on Fedora Linux and other systems that use yum for updates

  • The apt-cache search cups | less command for Debian Linux and other systems that use apt for updates

9.6.2. Configuring CUPS Printers

As the process of installing a printer on CUPS is straightforward, I won't describe it in detail here. While setting up /etc/cups/cupsd.conf is a complex process, the associated configuration tools available on Red Hat/Fedora (system-config-printer), SUSE (YaST), and Debian Linux (foomatic-gui) make the procedure elementary for the Linux geek. In most cases, you can also use the web-based tool for CUPS to configure printers.

The CUPS administration tool native to Red Hat/Fedora distributions does not include most of the printer drivers from linuxprinting.org. If you want to configure a printer via CUPS on these distributions, use their Printer Configuration tool, which you can start with the system-config-printer command. You can still organize these printers into groups as described in this section.


To set up a printer on CUPS, you need to know its manufacturer, model, and connection (USB, Serial, Parallel port, or network location). CUPS print tools can often detect printers shared from remote systems; otherwise, you can enter a Universal Resource Identifier (URI), which can be a URL or one of the other locations specified in Table 9-3.

Table 9-3. Universal Resource Identifiers for CUPS printers

URI example

Explanation

file:/home/print/new.prn

Processes the print job and send the output to the new.prn file

http://hostname:631/printers/printername

Processes the print job to the computer named hostname, on the printer named printername.

ipp://hostname:631/printers/printername

From another CUPS print server, processes the print job to the computer named hostname, on the printer named printername.

lpd://hostname/printername

From another CUPS print server, processes the print job on an LPD server on the computer named hostname, on the printer named printername.

socket://hostname

From a CUPS print server, prints to a network print server such as an HP Direct Jet. Some print servers require the use of port number 9100.


9.6.3. Sharing CUPS Printers

Not all distributions support sharing of CUPS printers. If you see a cupsd-browsing.conf file in your /etc/cups directory, edit it and change the Browsing directive from off to on. Alternatively, you may need to configure sharing in the cupsd.conf <Location /> stanza. For example, if you're running CUPS on Debian Linux, the following is the default version of that stanza, which supports printing from the local computer only:

 <Location />      Order Deny,Allow      Deny from All      Allow from 127.0.0.1 </Location> 

You can expand this to the local network by specifying the associated IP addresses with a directive such as:

 Allow from 192.168.0.0/255.255.255.0 

Alternatively, you can support sharing via the local network cards by adding the following directive to the stanza:

 Allow from @LOCAL 

9.6.4. Configuring CUPS Administrators

In this section, I'll show you how to configure administrative privileges for more than just the root user. You've read about CUPS, and you know about the web-based interface. So you navigate in your browser to what you've read is the TCP/IP port associated with CUPS, 631:

 http://127.0.0.1:631 

You're taken to the main CUPS menu, as shown in Figure 9-1.

Figure 9-1. CUPS administrative menu


If you select the Do Administration Tasks link, you'll see a pop-up window that asks for your username and password. Some distributions preconfigure the root account to configure CUPS. If the root account does not work, or if you want to assign another user as a CUPS administrator, you need to know how to configure the main CUPS configuration file and use the lppasswd command (see "Adding CUPS administrators," later in this annoyance).

9.6.4.1. Configuring CUPS for multiple administrators

The <Location /admin> stanza defines the users and systems allowed access to CUPS administrative functions. Most distributions, including Red Hat/Fedora, SUSE, and Debian, limit access to the local computer with the following directives:

 Order Deny,Allow Deny from All Allow from 127.0.0.1 

If you want to configure different users as CUPS administrators, you'll need the following directives within the <Location /admin> stanza:

 AuthType BasicDigest AuthClass Group 

Without an AuthType directive, all users would be able to administer CUPS printers. The BasicDigest option supports basic authentication using /etc/cups/passwd.md5 as a password-verification file. While this file encrypts passwords using MD5 encryption, crackers could still decipher the password, given enough time. As with /etc/shadow, it's important to limit access to this file to the file owner (by assigning the permission 600).

The AuthClass directive defines the level of authentication. If set to User, a valid username and password are required. It's best to set it to Group, where a valid username and password are required, and the user must belong to the group defined by the AuthGroupName directive.

You'll also need an appropriate entry for the AuthGroupName directive; one commonly used group name is lpadmin. You can even make up your own group name with a directive such as:

 AuthGroupName printadmin 

Once you're satisfied with your <Location /admin> stanza, save your changes and restart the CUPS daemon. The name varies between distributions. You can restart CUPS with the following command on Red Hat or SUSE:

 /etc/init.d/cups restart 

You can restart CUPS on Debian with the following command:

 /etc/init.d/cupsys restart 

9.6.4.2. Adding CUPS administrators

Now you can add the users you want as CUPS administrators. The usernames and passwords don't even have to correspond to any on your system. In fact, it's an excellent idea to configure a special CUPS account so ordinary users don't play around administering your printers.

To add a CUPS administrator, use the lppasswd command. For example, if I wanted to add user nancy as an administrator, and I included the AddGroupName printadmin directive in the <Location /admin> stanza in my cupsd.conf configuration file, I'd run the following command:

 lppasswd -g printadmin -a nancy 

I can delete this user from the administrative database with another straightforward command:

 lppasswd -g printadmin -x nancy 

9.6.5. Organizing Printers by Classes

Now that you've set up administrators, you can work on the strength of CUPS, which can organize printers by groups. Presumably, you've already installed more than one printer via CUPS, which you can verify via the /etc/cups/printers.conf file.

Adding a printer class is a straightforward process. If you use the web-based tool, take the following steps:

  1. Open the web-based tool. On the system with the CUPS server, navigate to http://127.0.0.1:631. Log in using one of the administrative accounts.

  2. From the top menu bar, click Classes. Near the bottom of the page, click the Add Class link.

  3. In the Add New Class page, designate a Name, Location, and Description for the group. The Name is what users will call from other clients. The Location is the hostname or network domain. And the Description is what users see when searching for a printer, and therefore can be whatever you want to show them.

  4. Now select the printers that you want as part of a class. You can select from printers already configured through this CUPS server. If you've configured CUPS printers using Red Hat's system-config-printer, SUSE's YaST, or Debian's foomatic-gui tool, you'll see those printers in the list.

    In most cases, you'll want to configure a group of printers from the same physical location as a class.

  5. Now the printer class name that you selected should be immediately available to other computers on the network.



Linux Annoyances for Geeks
Linux Annoyances for Geeks: Getting the Most Flexible System in the World Just the Way You Want It
ISBN: 0596008015
EAN: 2147483647
Year: 2004
Pages: 144
Authors: Michael Jang

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