[cups] Query queue Location/Description from command-line?

Jörg Thümmler listen at vordruckleitverlag.de
Tue Mar 28 22:37:02 PDT 2023


Hi,

some linuxes (suse e.g.) have their own APIs to manage printers and I 
think you can find the sources therefore on their platforms, but I doubt 
you want to adapt these... a lot of work and they are elevated as well...

if it's your intend to enable people to maintain printers, you will need 
elevationed prgs anyway, so what's the problem with a script reading the 
confs...
you can do the direct reading of the confs in a small C program and set 
the s-bit (setuid) for it (which is not possible for scripts afaik) as a 
workaround, and you can assign the C program just to do this, so it 
can't be misused...

-- 
cu

jth

Am 29.03.23 um 00:06 schrieb Peter Schultz:
> Is there some HTTP/HTTPS endpoint specifically for querying CUPS, such as
> some API? I could parse https://server.edu:631/printers/myprinter.
> 
> My ultimate intent is to enable people from my team to maintain printers
> via the scripts I'm working on.
> 
> Sincerely,
> Peter Schultz
> 
> --------------------
> 
> Applications Engineer, Enterprise Application Services
> Office of Information Technology
> University of Alaska System
> (c) (510) 557-5986 (preferred)
> (w) (907) 450-8342 (voicemail only)
> 
> 
> On Tue, Mar 28, 2023 at 1:50 PM Alex Korobkin <korobkin+cups at gmail.com>
> wrote:
> 
>> You can set up an elevated script to copy printers.conf into
>> printers.conf.bak on schedule with 644 permissions, and then parse that
>> file instead.
>>
>> On Tue, Mar 28, 2023 at 4:15 PM Peter Schultz <pwschultz2 at alaska.edu>
>> wrote:
>>
>>> I'm trying to write a script to synchronize related print queues via the
>>> command-line and I need to determine the given queue's Location and
>>> Description attributes (set via lpadmin) via script.
>>>
>>> I'd rather not have to run this script as an elevated user, meaning I'd
>>> rather avoid parsing printers.conf.
>>>
>>> I've perused all of the manpages I can find and nothing seems to let me
>> do
>>> this. Is there something I'm missing? Should I just curl localhost:631
>> for
>>> the printer in question?
>>>
>>> Sincerely,
>>> Peter Schultz
>>>
>>> --------------------
>>>
>>> Applications Engineer, Enterprise Application Services
>>> Office of Information Technology
>>> University of Alaska System
>>> _______________________________________________
>>> cups mailing list
>>> cups at cups.org
>>> https://lists.cups.org/mailman/listinfo/cups
>>>
>>
>>
>> --
>> -Alex
>> _______________________________________________
>> cups mailing list
>> cups at cups.org
>> https://lists.cups.org/mailman/listinfo/cups
>>
> _______________________________________________
> cups mailing list
> cups at cups.org
> https://lists.cups.org/mailman/listinfo/cups




More information about the cups mailing list