LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-18-2021, 04:13 AM   #1
stoorky
Member
 
Registered: Sep 2015
Posts: 63

Rep: Reputation: Disabled
Is it possible to prevent users to modify printer options in CUPS?


A small family setup...

I have a color printer, and a Linux computer, with CUPS installed. I wan to allow the kids to print, but only in draft mode, and only in greyscale.

With CUPS I prevented the kids' account from accessing the printer. Then I set up a second printer, for the same hardware printer, but with different default options (draft and greyscale), and allowed the kids to access this new printer.

It works, when they print the default options for this new printer are indeed draft and greyscale. But they are just that, default options. They can change it.

Is there a way to prevent users from changing the options of a printer ?
 
Old 02-18-2021, 06:17 AM   #2
floppy_stuttgart
Senior Member
 
Registered: Nov 2010
Location: EU mainland
Distribution: Debian like
Posts: 1,153
Blog Entries: 5

Rep: Reputation: 107Reputation: 107
My guess (never done it): when logged into the linux pc, the username used by the kids should not have the permission https://community.kde.org/Printing/CUPS/Access_Control
(all my pcs home has lpadmin group access and I dont have user restrictions; however I would look at the link and try it.. if I were you).
 
Old 02-19-2021, 01:27 AM   #3
stoorky
Member
 
Registered: Sep 2015
Posts: 63

Original Poster
Rep: Reputation: Disabled
@floppy_stuttgart : no, even non-members of lpadmin can change the print options before printing

Access Control is binary : either a user has access to a printer, or he doesn't. Access Control doesn't permit control what options of a printer a user has access to (no fine grained control).

Last edited by stoorky; 02-19-2021 at 04:38 AM. Reason: add info
 
Old 02-19-2021, 01:23 PM   #4
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Without a lot of in depth reading I found this link
https://www.cups.org/doc/policies.html
which may have some of the answers for your issue with cups.
 
Old 02-20-2021, 03:02 AM   #5
stoorky
Member
 
Registered: Sep 2015
Posts: 63

Original Poster
Rep: Reputation: Disabled
@computersavvy : same answer as given to @floppy_stuttgart. CUPS policies are binary, either you allow access to a print queue, or you don't. No fine grained control there. Thus, it can not be used to enforce specific print options.
 
Old 02-20-2021, 03:29 AM   #6
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,805

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
Quote:
With CUPS I prevented the kids' account from accessing the printer. Then I set up a second printer, for the same hardware printer, but with different default options (draft and greyscale), and allowed the kids to access this new printer.
For this second printer config, modify the ppd for that config so that only draft and greyscale output is possible (ie strip out the unwanted options).

Last edited by ferrari; 02-20-2021 at 03:40 AM.
 
1 members found this post helpful.
Old 02-20-2021, 07:29 AM   #7
stoorky
Member
 
Registered: Sep 2015
Posts: 63

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ferrari View Post
For this second printer config, modify the ppd for that config so that only draft and greyscale output is possible (ie strip out the unwanted options).

Thanks. Yes that's probably the way to go. I also just fell upon the Tea4CUPS project, which seems to provide a way to override options just before sending the job out to the printer.

https://wiki.debian.org/CUPSTea4CUPS
Quote:
A question which is sometimes seen concerns wanting to enforce default printer settings for applications and printing from the command line. It might be because some users on a network don't have the patience to check their printer settings or maybe it is seen as desirable to limit the alteration of some settings on an expensive-to-run colour printer. Within CUPS there is no surefire way of achieving this; a user is either allowed to print or not print.
Homepage : http://www.pykota.com/software/tea4cups
 
Old 02-20-2021, 03:47 PM   #8
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,805

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
Thanks for sharing those links re Tea4CUPS. Let us know how you get on.
 
Old 02-21-2021, 03:37 AM   #9
stoorky
Member
 
Registered: Sep 2015
Posts: 63

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ferrari View Post
Thanks for sharing those links re Tea4CUPS. Let us know how you get on.
I probably won't test Tea4CUPS. I just tested your idea (modifying the PPD). It's really straightforward and works perfectly, all I had to do is modifying /etc/cups/ppd/myDRAFTprinter.ppd and comment the "*OpenUI *ColorModel/Output Mode: PickOne" and "*OpenUI *OutputMode/Print Quality: PickOne " sections.

It works perfectly !

Only funny thing is, LibreOffice still shows the color and print mode option lists (but gray/draft is enforced, no matter what options the user chooses in LibreOffice). Other applications like Firefox don't show color and output mode dialogs anymore, as expected. I think it's due to the fact that LibreOffice does its own thing to build its print dialogs, it doesn't use GTK's standard print dialog. It's color options and output modes are probably hard-coded somewhere.

Anyway, it works, even with LibreOffice, the printer is now a "gray only draft printer" !

Thanks

Last edited by stoorky; 02-21-2021 at 03:39 AM.
 
Old 02-21-2021, 04:30 AM   #10
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,805

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
Good to read of your success with this. Glad to have been of guidance.

Last edited by ferrari; 02-21-2021 at 04:32 AM.
 
  


Reply

Tags
cups, print, printer sharing, restrictions, users



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I only modify /etc/cups/printers.conf the printer queue name brucefang Linux - Software 1 06-13-2011 03:24 AM
“CUPS-Add-Modify-Printer: Unauthorized” ajbardhan Linux - Newbie 2 03-31-2010 09:26 PM
greyed out backend options when adding printer (CUPS) NewConvertLX Linux - Hardware 1 11-19-2004 05:27 PM
How to modify the library path variable?modify the Electronkz Linux - Newbie 1 04-13-2004 06:18 AM
modify file access & modify timestamps i2itstud Linux - General 1 05-20-2003 03:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration