System and user default printer and the environment variables LPDEST and PRINTER?

Greg Alheid alheidgj at upmc.edu
Mon Feb 4 10:28:57 PST 2008


I’m coming from a Solaris environment and the precedence of the system 
and user “default printer” is documented.

Reading the CUPS documentation, I see that a user’s default printer
is set using the CUPS “lpoptions –d <prt_name>” command. Also that
when root uses the command “lpoptions –d <prt_name>”, its sets the
system default printer and options. I also see references to LPDEST
and PRINTER environment variables in release notes but can not find
any information on the precedence of them. (From the C code listing
of lp, I suspect that LPDEST before PRINTERS fo the lp command but
that is all.)

1. My first question is;
  What is the priority of the environment variables LPDEST and PRINTER,
  the “named printer” of “lp –d” and “lpr –P” commands and if it can be
  set, the system default when using CUPS?

2. My next question is;
  Like Sun Solaris, is the precedence different for the lp and
  lpr commands?

3. My next question is;
  How can a system default printer be unset?

   The following does not work to unset defaults.
     # lpoptions -d ""
     lpoptions: Unknown printer or class!

4. My next question is;
  In the man page for lpotions, it states the following;

   ROOT ACCOUNT OPTIONS
    When run by the root user, lpoptions gets and sets
    default options and instances for all users in the
    /etc/cups/lpoptions file.

  What does “sets default options” mean and how to unset?


The version of CUPS we are using on the Linux Pint Server is;
     # cups-config --version
     1.2.10


Greg Alheid
Senior Operating System Engineer
UPMC Health System


For reference, here is the information on the default printer on a
Sun Solaris 10 system. Quoting from the Sun manual page on printers
in Section 4;


Locating the Personal Default Destination

The default destination is located differently depending on
the (print) command (used).

The lp command locates the default destination in the following
order:

   1.  lp command's -d destination option.
   2.  LPDEST environment variable.
   3.  PRINTER environment variable.
   4.  _default destination in  $HOME/.printers.
   5.  _default destination in  /etc/printers.conf.

The lpr, lpq, and lprm commands locate the default destination
in the following order:

   1.  lpr command's -P destination option.
   2.  PRINTER environment variable.
   3.  LPDEST environment variable.
   4.  _default destination in  $HOME/.printers.
   5.  _default destination in  /etc/printers.conf.


(Doesn’t apply to which printer to use but is of interest as well.)
  Locating the Interest List for lpget, lpstat, and cancel
  The lpget, lpstat, and cancel commands locate the interest list
  in the following order:

   1.  _all list in $HOME/.printers.
   2.  _all list in /etc/printers.conf.

Thanks again for any information!




More information about the cups mailing list