Enable CUPS web portal Admin via script?

johnklimeck
Contributor II

Any ideas on how to script this:

Seems straight forward but it looks like switching users maybe required (which I am not sure is allowed in bash), as well as using 'dsenableroot', which requires including a root password. But then doing dsenableroot -d to disable at the end.... thx, john

4 REPLIES 4

joshuasee
Contributor III

Sorry, but straightforward though it may be, could you clarify what you want to do a bit? I take that it is something beyond simply turning the local CUPS web interface on?

johnklimeck
Contributor II

Sure, just want to do:

sudo cupsctl WebInterface=Yes

Which turns on the CUPS web portal, but also allows access to the Admin area, Add / Delete printers, etc.

But, this apparently uses 'dsenableroot', as well as local admin prompts and passwords to be input.

joshuasee
Contributor III

If you're running it as part of a casper policy under Files and Processes or Scripts, it is run as root by default and you can simply omit the sudo call.

If you just want to give non-admin users the ability to add and remove printers, you can modify membership in the lpadmin group and not bother with the local CUPS web interface.

dferrara
Contributor II

@johnklimeck,

@joshuasee is correct, you can easily run this in the Execute Command field of a policy. It works great!