[cups.development] customized printer list per user

Kurt Pfeifle k1pfeifle at gmx.net
Thu Sep 16 06:49:37 PDT 2004


On Thursday 16 September 2004 13:48, Martin Grimm wrote:

> Our problem: we need a customized printer list in CUPS depending on
> the user asking for it.
> 
> Here are the details:
> 
> Imagine a larger network with some network printers served by
> a cups print server and a linux based X application server accessed
> by remote X clients via NoMachine (www.nomachine.com). The clients
> have local printers. On connection to the X App server via ssh tunnel
> the local cups service is tunneled to the server and a script on
> the server adds the printer via lpadmin to the running CUPS server

I think this design detail of NoMachine's NX printing support is *flawed*
precisely because of that mess. I tried to discuss this with them
repeatedly, but their printing developers didnt want to listen or even 
talk about it.    :-(

Other than that, I think NoMachine's NX technology is the next big thing
in the computing world. It achieves wonders in speed on slow and high
latency links. I recommend to anyone who ever uses remote X access (or MS 
RDP remote access to Windows Terminal Servers, or VNC access) to at least
once testdrive NX (http://www.nomachine.com/testdrive.php)

There is workaround for your problem, if you use a KDE session on the NX 
server, or, if you use "kprinter" as your general print command inside 
GNOME sessions. 

The mechanic is this: KDEPrint is powerful enough and able to "filter" the 
list of printers indiviually to each user. (A user can set and change this 
for himself, or, if you use the KDE "Kiosk Mode" (an Enterprise Desktop 
feature), an administrator can lock it down to be immutable and the user 
only sees a pre-defined list of printers.)

To investigate the "printerlist filtering":

 * start "kprinter",
 * click "Expand", 
 * click "System Options...", 
 * select "Filter" (right column)

and find your way from there. (There is even an option to define the
filter list based on a regex on the "Location" string). To activate the 
filtering, click on the "funnel" icon sitting on the right of the printer 
drop-down list in the kprinter dialog.

The user-specific KDEPrint settings are written to "$HOME/.kde*/share/config/" 
into the files "kdeprintrc" and "kprinterrc". Look for the lines "LocationRe"
and "Printers" in the {Filter} section of kdeprintrc. Look for the lines 
"FilterEnabled" in the {KFileDialog Speedbar} section of kprinterrc.

If these files are written accordingly by a "nxaddcupsprinter.sh" script
upon the NX sesssion creation, you are there.

----

Fabian Franz and myself (from the FreeNX Development Team) had suggested 
an alternative architecture for NX printing support:

This would start a separate cupsd for each NX session. This new cupsd 
would run entirely in userspace of the remote NX server and not use the 
port 631, but its own. It woulod be completely separate from the system 
cupsd and from each other userspace cupsd. 

It would relay the info about its printers via an ssh-forwarded port 
(tunnelled thru the NX link). By this design, you wouldnt even need a 
password for the user, because you could alocal certificate as supported 
by CUPS. The userspace cupsd on the remote end could even receive the 
printer driver (==PPD) info via the CUPS standard browsing options. 

The printer connection would use a device-URI of
"http://<nxclient>:<forwarded-port>/printers/printername-of-nxclient"
An "nxaddcupsprintsupport.sh" script would need to be executed at each
connection. It would:
  * create a "$HOME/.nx/etc/cups/nxuser-cupsd.conf" with the specific 
    settings required (specifically it would set the "ServerRoot" 
    directive to "$HOME/.nx/etc/cups/" and the "BrowsePort" to non-631,
    and would only allow the user to connect).
  * create a ""$HOME/.nx/etc/cups/printers.conf" in the ServerRoot
    with the printers the user wanted to use in the session.
  * create a "$HOME/.cupsrc" (or is it "$HOME/.clientrc"?) for the
    user to point to his own userspace cupsd.
The userspace cupsd could be stripped to the bare necessities. It would
not need to use any local filtering and could forward the printjobs
to the "real" CUPS server (that is the NX client's CUPS server) for
processing.

On the NX Client you would also run a userspace cupsd to forward 
just the selected session printers to the remote NX end.

I hope you get the idea...

I hope the NoMachine developers will get it sometime too.

(To be fair, they had *one* valid objection: that was "what happens
if the session closes, and the remote userspace cupsd keeps running?".
That hasnt been addressed by me. I just expect them to write a "cleanup
daemon" or similar, which removes instances of NX session userspance 
cupsd where the session is lost.... After all, their current 
1.4 snapshot implementation isnt that clean at all in that it doesnt
delete NX printers after session termination, so they pile up more
and more from session to session. But, to be fair again, these are
"only" Beta snapshots, and the problem will likely be solved before the
final 1.4.0 release.)

> there with options -u, so only the user is able to print to it.
> 
> However all local printers of all clients are in the printer list on
> the server and so every user sees all local printers of all other users.
> Think of >300 client and you can imagine the mess.

But this is no different from what many users in Enterprise environments
see anyway (with CUPS or with Windows printing)....    ;-P

(It is an argument to implement "printerlist filtering" in CUPS 
regardless of NX.)

> Finally my question:
> 
> Is there anything we can do to hide the local printers of other users so
> every user sees only his local printer and the network printers.
> If this is not possible, is anything planned regarding this problem?

Search here: http://www.cups.org/str.php for a trouble report regarding
long lists of printers. Or create your own  ;-) 

> Kind regards,
> Martin Grimm

Cheers,
Kurt





More information about the cups mailing list