CUPS: silent authentication for printing

Solved
lenainjaune Posted messages 726 Registration date   Status Contributeur Last intervention   -  
mamiemando Posted messages 33540 Registration date   Status Modérateur Last intervention   -
Hello everyone,

Under Buster, I'm looking for a solution to print with CUPS without having to provide a password every time. Under Windows, I just had to enter the credentials for the desired print port, and it wouldn't ask for a password during printing anymore.

For your information, for traceability purposes, each PC is authenticated by an account created on the CUPS server, and our printers are not directly visible; you have to go through the CUPS server redirected by the /etc/cups/client.conf file of each client with the ServerName directive and pre-filled during printing by the User directive.

How can I do the same under Debian?

With regards,
lnj

5 réponses

mamiemando Posted messages 33540 Registration date   Status Modérateur Last intervention   7 927
 
Hello,

I forgot to mention (but I can't modify the original message) that it's a network copier in a heterogeneous Windows/Linux park.

This is an important aspect of the question, as for me, you were talking about a local printer, e.g. connected via USB.

Prerequisites

Depending on the operating system running on the machine from which the printing must be initiated, the window that allows you to make this adjustment is hidden in different admin rights
  • If the machine is running Windows, you've already found it, so I'll skip it.
  • If the client is using Linux, the declaration of a printer (networked or not) is done via CUPS. It may be useful to emphasize that CUPS is a server in the software sense, but nonetheless, the machine in question is a client of the printer in the network sense. In fact, CUPS is a kind of relay. In short, any Linux that wishes to print must have its CUPS, and in CUPS, the printer or printers concerned must be declared.


CUPS: administration interface

To administer CUPS, you can use one of these two interfaces:
  • either directly in the CUPS web interface by connecting to http://localhost:631;
  • or via
    system-config-printer
    (this is a graphical interface that allows you to configure CUPS).


CUPS: authentication

In the chosen interface, you then need to add a network printer. To do this, you will need to authenticate to be an administrator in the sense of CUPS, thus with a login belonging to the
lpadmin
group.

Example: on your machine, to administer CUPS, you can use the login
lnj
(since it has been added to the lpadmin group) or of course,
root
who has all rights.

CUPS: declaring the printer

Once authenticated, you just have to declare the printer:
  • In CUPS: Administration > Add Printer > (choose the appropriate protocol).
  • In
    system-config-printer
    : same principle.


Of course, if the printer is already declared, you just need to correct its properties (right-click properties in
system-config-printer
).

CUPS: printer connection parameters

As explained in this link, you simply need to adapt the printer's URI, whose general syntax is of the following form:

The "device-uri" will be of the form 'scheme://[username:password@]hostname[:port]/[resource]', where scheme may be "http", "https", "ipp", "lpd", "smb", or "socket" in the current implementation.

Example: for a printer accessed via IPP protocol, listening on port
9100
and whose IP address is
11.22.33.44
, and for which we print as
paul
, the URI would be:
ipp://paul@11.22.33.44:9100


Good luck
2
lenainjaune Posted messages 726 Registration date   Status Contributeur Last intervention   62
 
I'm just stopping by to give some news... to say that things are progressing, but I'm not at the finish line yet.

I spent all of yesterday researching (and translating), searching, and testing ... but with little result.

To simplify my life, I used the command
lpadmin


The only thing I managed to achieve was printing only from Geany but NOT from LibreOffice Writer (strange) with the backend dnssd (Protocol Bonjour), here's the command:
lnj@host:~$ lpadmin -p fake -E -v dnssd://lnj:1234@KONICA%20MINOLTA%20C280%20%40%20serveur._ipp._tcp.local/cups?uuid=UID -P /BizhubC280/Linux/Français.ppd 


However, the password prompt was still there; apparently, it didn't change anything, and when I tried to test it again, it didn't work this time.

Why did I test this URI with the backend dnssd? Because it was part of those returned by
lpinfo -v


I can't find any documentation or tutorial to set up a CUPS server with authentication for printing. I wasn't the one who set it up.

I would also like to trace/debug what's happening when I print to see where the problem is. For now, I've just looked at the /var/log/cups but didn't see anything particular. I will need to take another look.

So that's where I am!
0
mamiemando Posted messages 33540 Registration date   Status Modérateur Last intervention   7 927 > lenainjaune Posted messages 726 Registration date   Status Contributeur Last intervention  
 
I'm surprised that the result is different in
libreoffice
and
geany
since both go through
cups
. Then maybe the
dnssd://
protocol doesn't support the
login:password@...
syntax. To be honest, I've never had to configure a CUPS server where you specified the login and password, so I've never encountered the issue.

In the meantime, I found this discussion which seems like an interesting lead. Have you tested it?

Good luck
0
lenainjaune Posted messages 726 Registration date   Status Contributeur Last intervention   62 > mamiemando Posted messages 33540 Registration date   Status Modérateur Last intervention  
 
I confirm that the list of printers may be different between Libre Office and other applications. I don't have it in front of me, but I noticed it yesterday (even after waiting a few moments).

After that, it's another issue...
0
mamiemando Posted messages 33540 Registration date   Status Modérateur Last intervention   7 927 > lenainjaune Posted messages 726 Registration date   Status Contributeur Last intervention  
 
This discussion suggests that it could be caused by the absence of the package
gtk3-print-backends
. Have you installed it?
0
lenainjaune Posted messages 726 Registration date   Status Contributeur Last intervention   62 > mamiemando Posted messages 33540 Registration date   Status Modérateur Last intervention  
 
I checked and found it under Debian Buster, and the package does not seem to be installed (
dpkg -l
) and apparently is not installable in this distro (at least not under the name gtk3-print-backends).
0
lenainjaune Posted messages 726 Registration date   Status Contributeur Last intervention   62
 
It's good, it's working :D

I started from scratch with a new and isolated CUPS installation, and I applied the same settings as on the existing CUPS in /etc/cups/cupsd.conf.

In the end, the URI with silent authentication that works to access CUPS (configured by default) is:

ipp://<user>:<mdp>@<serveur_cups>:631/printers/<imprimante>
ex: ipp://lnj:1234@cups.local:631/printers/KONICA_MINOLTA_C280

Note: with CUPS configured by default, printers are accessible here: http://localhost:631/printers

I tested on the already existing CUPS server... it worked, NO password prompt :)

I don't know why I couldn't get it to work before, but in the end, it helped me understand a lot about setting up CUPS. I'm also in the process of creating a tutorial/template for setting up mandatory authentication by CUPS (I'll make sure to come back when it's in place).

So thank you mamiemando and looking forward to it :)

Problem solved then

PS: I'm changing the title because I found a more suitable phrase
CUPS: no longer asking for a password when printing -> CUPS: silent authentication when printing

1
lenainjaune Posted messages 726 Registration date   Status Contributeur Last intervention   62
 
Anyone to help me?

Is my request unclear?

--
I have questions for all your answers. (Woody Allen)
0
jns55
 
Hi,
It may just be because no one has the answer...
0
lenainjaune Posted messages 726 Registration date   Status Contributeur Last intervention   62 > jns55
 
Hi,

Apparently, I've browsed through a lot of threads on the net and I'm thinking I might not have the right approach. There must be a solution; otherwise, it means that Microsoft will remain in a monopoly position on these basic things. It's sad :(
0
mamiemando Posted messages 33540 Registration date   Status Modérateur Last intervention   7 927
 
Hello,

I assume you are trying to print from some application (like LibreOffice).
Is your user in the
lpadmin
group (see the result of the
groups
command, which you can type in a terminal).

Example :

(mando@aldur) (~) $ groups
mando voice cdrom floppy sudo audio dip video plugdev netdev bluetooth lpadmin scanner pulse pulse-access


Assuming your login is
toto
:

sudo usermod -a -G lpadmin toto


... then restart.

No one to help me?
Is my request unclear?


Another piece of advice: do not write in a discussion thread where you have not yet received a response, as your message will be less visible (someone might mistakenly believe that someone has already started responding to you).

Good luck.
0
lenainjaune Posted messages 726 Registration date   Status Contributeur Last intervention   62
 
Hello mamiemando and thank you for giving me your time as you have in the past :)

I suppose you are trying to print from some application (like LibreOffice).

Yes, generally from office tools (LibreOffice, Thunderbird, Firefox, Evince, any text editor like Geany, Leafpad, Mousepad, ...) but also from drawing tools (The Gimp, Photoflare, and Photofiltre via Wine)

My user is already part of the lpadmin group and it still doesn't work, so there must be another prerequisite (or my installation is messed up)

By the way, can you give me your source regarding the need for belonging to the lpadmin group, because I have searched a lot on the internet (maybe poorly) but I find little information regarding printing with authentication on CUPS?

Another piece of advice: don't reply in a discussion thread where you haven't received a response yet, as your message will be less visible (one might wrongly think that someone has already started to respond to you).

Thanks for the advice, it's true that sometimes patience eludes me... After how much time do you find it appropriate to revive a thread?
0
mamiemando Posted messages 33540 Registration date   Status Modérateur Last intervention   7 927 > lenainjaune Posted messages 726 Registration date   Status Contributeur Last intervention  
 
Hello lenainjaune,

Thank you for giving me your time as you have in the past :)

You're welcome ;-)

My user is already part of the lpadmin group and it's not working, so there must be another prerequisite (or maybe my installation is messed up)

Have you thought about restarting or logging back in?

By the way, can you provide me with your source regarding the need to belong to the lpadmin group, as I’ve searched a lot on the internet (maybe poorly) but find little information regarding printing with authentication on CUPS?


Yes:

Can you confirm that your user is indeed a member of the
lpadmin
group with the command
groups
?

Thanks for the advice, it’s true that sometimes patience is lacking for me... After how long do you think it’s appropriate to bump a thread?

Well, in the case of the Linux forum, I would say never, because that’s the best way for me to miss it! Indeed, every time I pass by, I try to respond to people who haven’t yet received an answer.
0
lenainjaune Posted messages 726 Registration date   Status Contributeur Last intervention   62 > mamiemando Posted messages 33540 Registration date   Status Modérateur Last intervention  
 
I forgot to mention (but I can't modify the original message) that it's a network printer in a heterogeneous Windows/Linux park.

Have you thought about restarting or logging back in?
Yes, of course ;)

Can you confirm that your user is indeed a member of the lpadmin group with the command groups?

lnj@host:~$ groups lnj cdrom floppy sudo audio dip video plugdev netdev libvirt lpadmin wireshark libvirt-qemu 



Well, in the case of the Linux forum, I would say never, because that's the best way for me to miss something! Indeed, every time I pass by, I try to respond to people who haven't received an answer yet.


Wow! I'm impressed that some volunteers have this approach. A big thank you for your involvement (especially in a volunteer capacity) and for taking the time to write real sentences. Much respect :D

However, I feel like we are not talking about the same thing...

From the link Debian doc: lpadmin (LPADMIN): Allows members to manage printers and pending jobs sent by other users.
In the language of Molière: "Allows members to manage printers and pending jobs sent by other users."

That's not my case; I'm neither looking to manage printers nor the jobs of other users.

What I want on a network printer is for my print job to be authenticated and then logged (today Paul printed 10 pages in color). As it stands, it works very well: from his session, Paul requests to print a document, the client.conf file pre-fills the user field in the popup that appears:

He just has to enter his password to authenticate that it is indeed him ... and it prints. But if he has 50 prints to do, he will have to enter his password 50 times before confirming each print (it's a bit cumbersome).

What I'm looking for is a way to provide the password without him having to type it. Under Windows, this is done simply in the printer port configuration (as here under Windows 10):
0
mamiemando Posted messages 33540 Registration date   Status Modérateur Last intervention   7 927
 
Hello the yellow dwarf,

First of all, congratulations! It's great to see that everything is working as you hoped and especially to see that you've learned a lot (I’ve learned some things too as I've never faced this issue before). Great job renaming the title, I mark the issue as resolved.

Best of luck :-)
0