[cups.general] System and user default printer and the environment variables LPDEST and PRINTER?

Michael R Sweet msweet at apple.com
Mon Feb 4 11:18:51 PST 2008


Greg Alheid wrote:
> 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?

The precedence is as follows:

     1. LPDEST environment variable, as long as the value is not "lp"
        (which is silently ignored for historical reasons)

     2. PRINTER environment variable, as long as the value is not "lp"

     3. Default printer defined in ~/.cups/lpoptions (set via
        "lpoptions -d printer" or any other program using the
        cupsSetDests API)

     4. Default printer defined in /etc/cups/lpoptions (set by root
        via the mechanisms in #3)

     5. Server default printer defined via "lpadmin -d printer", the
        web interface, or the CUPS_SET_DEFAULT IPP operation.  The
        default is stored in /etc/cups/classes.conf,
        /etc/cups/printers.conf, or /var/cache/cups/remote.cache,
        depending on the type of queue.

     6. Network default printer from another CUPS system sharing its
        printer via CUPS browsing (and that server's default would be
        set via #5)

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

No, the precedence is the same since doing otherwise can be confusing.

> 
> 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!

It cannot be unset via a command at this time.  All you can do is
delete the printer or do something like:

     lpadmin -p dummy
     lpadmin -d dummy
     lpadmin -x dummy

> 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?

Default options means options that are automatically added to a
lp/lpr command, e.g.:

     lp -o media=letter filename
     lpr -o media=letter filename

vs.:

     lpoptions -o media=letter
     lp filename
     lpr filename

Options are removed using the "-r" option (documented in the
lpoptions man page...)

-- 
______________________________________________________________________
Michael R Sweet                        Senior Printing System Engineer





More information about the cups mailing list