System Administration Guide, Volume 2

Setting or Resetting Miscellaneous Printer Definitions

This section provides step-by-step instructions on setting or resetting printer definitions. Some of the following printer definitions can be set using Solaris Print Manager. The procedures below use the LP commands to quickly set or reset printer definitions.

How to Add a Printer Description

  1. Log in as superuser or lp on the print server.

  2. Add a printer description by using the lpadmin(1M) command.


    # lpadmin -p printer-name -D "comment"

    -p printer-name

    Name of the printer for which you are adding a description. 

    -D "comment"

    Specifies the characteristics of the printer, such as location or administrative contact. Enclose characters that the shell might interpret (like *, ?, \, !, ^) in single quotation marks.

    The printer description is added in the print server's /etc/lp/printers/printer-name/comment file.

  3. Verify the Description information is correct.


    $ lpstat -p printer-name -l
    

Example--Adding a Printer Description

In the following example, the command adds a printer description for the printer luna.


# lpadmin -p luna -D "Nathans office"

Setting Up a Default Printer Destination

You can specify a default printer destination for a user so the user doesn't need to type the printer name when using the print commands. Before you can designate a printer as the default, the printer must be known to the print service on the system. You can set a user's default printer destination by setting any of the following:

When an application provides a printer destination, that destination is used by the print service, regardless of whether you have set a system's default printer destination. If an application doesn't provide a printer destination or if you don't provide a printer name when using a print command, the print command searches for the default printer in a specific order. The table below shows the search order for a system's default printer destination.

Table 5-1 Search Order for Default Printer Destinations

Search Order 

Using /usr/bin/lp Command

Using SunOS/BSD Compatibility Commands (lpr, lpq, and lprm)

First 

LPDEST variable

PRINTER variable

Second 

PRINTER variable

LPDEST variable

Third 

System's default printer 

System's default printer 

How to Set a System's Default Printer

  1. Log in as superuser or lp on the system for which you want to set a default printer.

  2. Set the system's default printer by using the lpadmin command.


    # lpadmin -d [printer-name]

    -d printer-name

    Name of the printer you are assigning as the system's default printer. If you don't specify printer-name, the system is set up with no default printer.

    The default printer name is entered in the system's /etc/lp/default file.

  3. Check the system's default printer by using the lpstat command.


    $ lpstat -d
    

Example--Setting a System's Default Printer

In the following example, the command sets the printer luna as the system's default printer. This means that luna will be used as the system's default printer if the LPDEST or PRINTER environment variables are not set.


# lpadmin -d luna
# lpstat -d
system default destination: luna

Printing Banner Pages

A banner page identifies who submitted the print request, the print request ID, and when the request was printed. A banner page will also have a modifiable title to help users identify their printouts.

Banner pages make identifying the owner of a print job easy, which is especially helpful when many users submit jobs to the same printer. Printing banner pages uses more paper, however, and might not be necessary if a printer has only a few users. In some cases, printing banner pages is undesirable. For example, if a printer has special paper or forms mounted, like paycheck forms, printing banner pages might cause problems.

By default, the print service forces banner pages to be printed. However, you can give users a choice to turn off printing of a banner page when they submit a print request. You can set this choice through the lpadmin command or through Admintool. If you give the users a choice, they have to use the -o nobanner option to turn off printing of a banner page.

Also, you can turn off banner pages for a printer so they are never printed. This is important if you have a situation where you don't need or want banner pages. You can turn off banner page printing by using the lpadmin command.

Table 5-2 Banner Page Printing

With This Command .... 

Banner Page Printing Is ... 

Override? 

lpadmin -p printer -o banner or

lpadmin -p printer -o banner=always

Required and printed 

If you are a regular user and use lp -o nobanner, the request is printed, but the nobanner argument is ignored.

If you are root or lp, the nobanner argument is honored.

lpadmin -p printer -o nobanner

lpadmin -p printer -o banner=optional

On by default, but can be disabled on a per request basis with the lp -o nobanner command.

N/A 

lpadmin -p printer -o banner=never

Disabled 

No 

For step-by-step command-line instructions, see "How to Turn Off Banner Pages".

How to Make Banner Pages Optional

  1. Log in as superuser or lp on the print server.

  2. Make banner pages optional by using the lpadmin command.


    # lpadmin -p printer-name -o nobanner=optional
    

    -p printer-name

    Name of the printer for which you are making banner pages optional. 

    -o nobanner=optional

    Enables users to specify no banner page when they submit a print request. 

    If you want to force a banner page to print with every print request, specify the -o banner=always option.

    The banner page setting is entered in the print server's /etc/lp/printers/printer-name/configuration file.

  3. Verify the output from the following command contains the line Banner not required.


    $ lpstat -p printer-name -l
    

Example--Making Banner Pages Optional

In the following example, the command enables users to request no banner page on the printer luna.


# lpadmin -p luna -o nobanner=optional

How to Turn Off Banner Pages

  1. Log in as superuser or lp on the print server.

  2. Turn off banner printing by using the lpadmin command.


    lpadmin -p printer-name -o nobanner=never
    

    -p printer-name

    Name of the printer for which you are making banner pages optional. 

    -o nobanner=never

    Disables banner page printing under all circumstances. 

    The banner page setting is entered in the print server's /etc/lp/printers/printer-name/configuration file.

  3. Verify the output from the following command contains the line Banner not printed.


    $ lpstat -p printer-name -l
    
  4. Submit a print request to the printer to make sure a banner page does not print.

Example--Turning Off Printing Banner Pages

In the following example, the command disables printing banner pages on the printer luna.


# lpadmin -p luna -o nobanner=never

Setting Up Printer Classes

The print service enables you to group several locally attached printers into one class. You can perform this task only by using the lpadmin -c command.

When you have set up a printer class, users can then specify the class (rather than individual printers) as the destination for a print request. The first printer in the class that is free to print is used. The result is faster turnaround because printers are kept as busy as possible.

There are no default printer classes known to the print service; printer classes exist only if you define them. Here are some ways you could define printer classes:

Alternatively, a class might contain several printers that are used in a particular order. The LP print service always checks for an available printer in the order in which printers were added to a class. Therefore, if you want a high-speed printer to be accessed first, you would add it to the class before you add a low-speed printer. As a result, the high-speed printer would handle as many print requests as possible. The low-speed printer would be reserved as a backup printer when the high-speed printer is in use.


Note -

Print requests are balanced between printers in a class only for local printers.


Class names, like printer names, must be unique and can contain a maximum of 14 alphanumeric characters and underscores.

You are not obligated to define printer classes. You should add them only if you determine that using printer classes would benefit users on the network.

How to Define a Class of Printers

  1. Log in as superuser or lp on the print server.

  2. Define a class of printers by using the lpadmin command.


    # lpadmin -p printer-name -c printer-class
    

    -p printer-name

    Name of the printer you are adding to a class of printers. 

    -c printer-class

    Name of a class of printers. 

    The specified printer is added to the end of the list in the class in the print server's /etc/lp/classes/printer-class file. If the printer class does not exist, it is created.

  3. Verify the printers in a printer class by using the lpstat command.


    $ lpstat -c printer-class
    

Example--Defining a Class of Printers

In the following example, the command adds the printer luna in the class roughdrafts.


# lpadmin -p luna -c roughdrafts

Setting Up Printer Fault Alerts

If you choose, the print service can notify you when it detects a printer fault. You can select any of the following methods to receive printer fault notification with the lpadmin -A command or with Solaris Print Manager:

However, the lpadmin -A command offers you an additional option of receiving a message specified by the program of your choice. It also enables you to selectively turn off notification for an error that you already know about.

Unless you specify a program to deliver fault notification, the content of the fault alert is a predefined message that says the printer has stopped printing and needs to be fixed.

The table below lists the alert values that you can set for a printer with the lpadmin -A command. These alert values can also be set for print wheels, font cartridges, and forms.

Table 5-3 Values for Printing Problem Alerts

Value for -A alert

Description 

'mail [user-name]'

Send the alert message by email to root or lp on the print server, or the specified user-name, which is a name of a user.

'write [user-name]'

Send the alert message to the root or lp console window on the print server, or to the console window of the specified user-name, which is a name of a user. The specified user must be logged in to the print server to get the alert message.

'command'

Run the command file for each alert. The environment variables and current directory are saved and restored when the file is executed.

quiet

Stop alerts until the fault is fixed. Use this when you (root or specified user) receive repeated alerts. 

none

Do not send any alerts. This is the default if you don't specify fault alerts for a printer. 

How to Set Fault Alerts for a Printer

  1. Log in as superuser or lp on the print server.

  2. Set fault alerts for a printer with the lpadmin command.


    # lpadmin -p printer-name -A alert [-W minutes]

    -p printer-name

    Name of the printer for which you are specifying an alert for printer faults. 

    -A alert

    Specifies what kind of alert will occur when the printer faults. See Table 5-3 for detailed information about the valid values for alert. Some valid values are mail, write, and quiet.

    -W minutes

    Specifies how often (in minutes) the fault alert will occur. If you don't specify this option, the alert is sent once. 

    The fault alert setting is entered in the print server's /etc/lp/printers/printer-name/alert.sh file.

  3. Check the information following the On fault heading from the output of the following command.


    $ lpstat -p printer-name -l
    

Examples--Setting Fault Alerts for a Printer

In the following example, the command sets up the printer mars to send fault alerts by email to a user named joe, with reminders every 5 minutes.


# lpadmin -p mars -A 'mail joe' -W 5

In the following example, the command sets up the printer venus to send fault alerts to the console window, with reminders every 10 minutes.


# lpadmin -p venus -A write -W 10

In the following example, the command stops fault alerts for the printer mercury.


# lpadmin -p mercury -A none

In the following example, the command stops fault alerts until the printer venus has been fixed.


# lpadmin -p venus -A quiet

Setting Up Printer Fault Recovery

If you choose not to send any fault notification, you can find out about printing faults so you can correct the problem. The LP print service will not continue to use a printer that has a fault. In addition to alerts for printer faults, you can also provide alerts that tell the system administrator to mount print wheels, font cartridges, and forms when print requests require them.

You can define the fault recovery options for a printer only by using the lpadmin -F command. This task is not available in Solaris Print Manager.

Printer faults can be as simple as running out of paper or needing to replace a toner cartridge. Other more serious problems can include complete printer failure or power failure. After you fix a printer fault, the print request that was active when the fault occurred begins printing in one of three ways:

A print filter is required to continue printing from the top of a page where the printing stopped. A print filter records the control sequences used by the printer to track page boundaries, which the default filters used by the print service cannot do. You will be notified by the print service if recovery cannot proceed with the specified print filter. For information about writing filters, see "How to Create a New Print Filter".

If you want printing to resume immediately after a printer fault is fixed, enable the printer by using the enable command.

The table below lists the fault recovery values you can set for a printer with the lpadmin -F command.

Table 5-4 Values for Printer Fault Recovery

Value for -F recover-options

Description 

beginning

After a fault recovery, printing restarts from the beginning of the file. 

continue

After a fault recovery, printing starts at the top of the page where the printing stopped. This recovery option requires a print filter.

wait

After a fault recovery, printing stops until you enable the printer. After you enable the printer (enable command), printing starts at the top of the page where printing stopped. This recovery option requires a print filter.

How to Set Printer Fault Recovery

  1. Log in as superuser or lp on the print server.

  2. Set up fault recovery for the printer with the lpadmin(1M) command.


    # lpadmin -p printer-name -F recovery-options
    

    -p printer-name

    Name of the printer for which you are specifying fault recovery. 

    -F recovery-options

    One of the three valid recovery options: 

    beginning, continue, or wait.

    See Table 5-4 for detailed information about the valid values for recovery-options.

    The fault recovery setting is entered in the print server's /etc/lp/printers/printer-name/configuration file.

  3. Check the information following the After fault heading in the output of the following command.


    $ lpstat -p printer-name -l
    

Example--Setting Printer Fault Recovery

In the following example, the command sets up the printer luna to continue printing at the top of the page where printing stopped.


# lpadmin -p luna -F continue

Limiting User Access to a Printer

You can control which users can access some or all of the available printers. For example, you can prevent some users from printing on a high-quality printer to minimize expense. To restrict user access to printers, you can create allow and deny lists using the lpadmin -u command on the print server. (Solaris Print Manager enables you to create only allow lists.) If you create neither, a printer is available to all users who can access the printer.

An allow list contains the names of users allowed access to the specified printer; a deny list contains the names of users denied access to the specified printer.

The rules for allow and deny lists are:

When You ... 

Then ... 

Do not create allow and deny lists, or if you leave both lists empty 

All users can access the printer. 

Specify all in the allow list

All users can access the printer. 

Specify all in the deny list

All users, except root and lp (on the server), are denied access to the printer. 

Make any entry in the allow list 

The deny list is ignored. Only those users who are listed can access the printer. 

Create a deny list, but you do not create an allow list or you leave the allow list empty 

Users who are listed in the deny list are denied access to the printer. 

Because the print server is actually controlling access to the printer, allow and deny lists can only be created on the print server itself. If you create allow and deny lists, the print server will exclusively control user access to printers.

The table below lists the values you can add to an allow or deny list to limit user access to a printer.

Table 5-5 Values for Allow and Deny Lists

Value for user-list

Description 

user

User on any system

all

All users on all systems 

none

No user on any system 

system!user

User on system only

!user

User on local system only

all!user

User on any system

all!all

All users on all systems 

system!all

All users on system

!all

All users on local system 

How to Limit User Access to a Printer

  1. Log in as superuser or lp on the print server.

  2. Allow or deny users access to a printer by using the lpadmin command.


    # lpadmin -p printer-name -u allow:user-list [ deny:user-list]

    -p printer-name

    Name of the printer to which the allow or deny user access list applies. 

    -u allow:user-list

    User names to be added to the allow user access list. You can specify multiple user names with this command. Use a space or a comma to separate names. If you use spaces, enclose the list of names in quotes. 

    Table 5-5 provides the valid values for user-list.

    -u deny:user-list

    User names to be added to the deny user access list. You can specify multiple user names with this command. Use a space or a comma to separate names. If you use spaces, enclose the list of names in quotes. 

    Table 5-5 provides the valid values for user-list.

    The specified users are added to the allow or deny user access list for the printer in one of the following files on the print server:

    /etc/lp/printers/printer-name/users.allow

    /etc/lp/printers/printer-name/users.deny


    Note -

    If you specify none as the value for user-list in the allow user access list, the following files are not created for the print server:

    /etc/lp/printers/printer-name/alert.sh

    /etc/lp/printers/printer-name/alert.var

    /etc/lp/printers/printer-name/users.allow

    /etc/lp/printers/printer-name/users.deny


  3. Check the information following the Users allowed or Users denied heading in the output of the following command.


    $ lpstat -p printer-name -l
    

Examples--Limiting User Access to a Printer

In the following example, the command allows only the users nathan and george access to the printer luna.


# lpadmin -p luna -u allow:nathan,george

In the next example, the command denies the users nathan and george access to the printer asteroid.


# lpadmin -p asteroid -u deny:"nathan george"