Skip to main content
Question

lpadmin question

  • April 24, 2013
  • 7 replies
  • 33 views

ImAMacGuy
Forum|alt.badge.img+23

So I opened a ticket with AppleCare and they gave me a lpadmin command that changes from username/password to negotiate, but I have to specify a printer each time I want to use it. Is there a way to have it do every printer installed on the users machine to fix the existing ones? And is it possible to change the casper definitions so it comes down on new definition installs? We have over nearly 600 printers, so redoing each one individually doesn't sound like a fun undertaking.

the cmd is: ```
sudo lpadmin -p <printername> -o auth-info-required=negotiate
```

*Updated* Removed a space between = and negotiate *

7 replies

Forum|alt.badge.img+9
  • Valued Contributor
  • April 24, 2013

I have a startup policy that installs printers and runs a script that parses through all smb printers to run that command. I might have even found it here somewhere.

edit:
There we go: https://jamfnation.jamfsoftware.com/discussion.html?id=4075


mm2270
Forum|alt.badge.img+24
  • Legendary Contributor
  • April 24, 2013

lpstat -p is probably what you're looking for.

It lists all the mapped printers on a system, including the state, such as idle, enabled, disabled, etc.
A script to loop through everything from the command:

lpstat -p | awk '{print $2}'

may do what you want.


Forum|alt.badge.img+7
  • Contributor
  • April 25, 2013

I would use the command posted by mm2270, something like this

#!/bin/sh
for printer in $(lpstat -p | awk '{print $2}')
do
    lpadmin -p $printer -o auth-info-required=negotiate
done

ImAMacGuy
Forum|alt.badge.img+23
  • Author
  • Esteemed Contributor
  • April 25, 2013

I followed the link that barnesaw posted, made the launchagent and the script... but I can't seem to tell if it's running. I reset the print system and deleted the drivers. but the only way I was able to get a response was when I had the permissions messed up on the launchagent and it prompted with ...

4/25/13 8:54:36.400 AM launchctl[8934]: launchctl: Dubious ownership on file (skipping): /Library/LaunchAgents/com.318.cupswatcher.plist

Once I fixed the permissions of the file I don't get any more entries in the logs, and the printers still seem to prompt for credentials.


ImAMacGuy
Forum|alt.badge.img+23
  • Author
  • Esteemed Contributor
  • April 25, 2013

quick update -

The first time I try to pint after setting to negotiate it prints fine. Then I tried another printer (verified in the printers.conf that it also is set to negotiate), and it prompts right away.
So I tried the 1st printer again and it's now prompting.

So I did the klist and now it shows I don't have a tgt
ushofml313065:~ jwojda$ klist
klist: krb5_cc_get_principal: No credentials cache file found

So I printed a test page again… and did a klist
ushofml313065:~ jwojda$ klist
Credentials cache: API:528610587:6 Principal: jwojda@KIH.KMART.COM

Issued Expires Principal
Apr 25 11:55:35 2013 Apr 25 21:55:35 2013 krbtgt/KIH.KMART.COM@KIH.KMART.COM
Apr 25 11:55:36 2013 Apr 25 21:55:35 2013 cifs/USHOFSVMPRT01.kih.kmart.com@KIH.KMART.COM

Then I did a klist after the print job finished.

ushofml313065:~ jwojda$ klist
klist: krb5_cc_get_principal: No credentials cache file found


Forum|alt.badge.img+9
  • Valued Contributor
  • April 25, 2013

It looks like something is kdestroy-ing at the end of each print job. I'm not seeing this in our Lion lab environment, and I don't believe I've seen that in the few mountain lion systems we have out there.

edit:
And, of course, Apple's answer is to use OD for printing.


donmontalvo
Forum|alt.badge.img+36
  • Hall of Fame
  • April 25, 2013

Have you tried -o printer-op-policy='authenticated' ?

https://jamfnation.jamfsoftware.com/discussion.html?id=7082