1846619 Members
1435 Online
110256 Solutions
New Discussion

cancel print jobs

 
SOLVED
Go to solution
Paul Sperry
Honored Contributor

cancel print jobs

I have a simple script that I want a certain user to use to cancel print jobs. Here it is:

#!/usr/bin/ksh
export PATH=$PATH:/usr/local/bin:/usr/bin
echo Please enter Printer:
read printer
lpstat -o$printer
echo Which Job number to cancel, CR for none:
read cancel
super cancel $cancel

My super.tab file has the following entry.

cancel /usr/bin/cancel prntmgr:@saturn

When I run it is root it works but when I run it as the prntmgr user I get

request "lj0-15" not cancelled: not owner

Other super commands are working I just can't seem to get the cancel to work

HP-UX 11.11

Any ideas welcome

Thanks




15 REPLIES 15
Geoff Wild
Honored Contributor

Re: cancel print jobs

Yes - only root can cancel print jobs for other users...

What I did here for our helpdesk, is setup resticted SAM - then have them go into SAM to delete spools....

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Paul Sperry
Honored Contributor

Re: cancel print jobs

Geoff

Thanks for the input but
shouldn't the fact that the cancel
command is being ran with super take care
the issue?
Hazem Mahmoud_3
Respected Contributor

Re: cancel print jobs

Was the print request put in by root or prntmgr? If put in by root, then I believe only root can cancel it. I think user prntmgr can still cancel print jobs, if it originated from that user. Try submitting a print request using prntmgr and then try cancelling it.

-Hazem
Rodney Hills
Honored Contributor

Re: cancel print jobs

My guess is the problem is because your printer is on a remote server.

The fact you use "super" to set your effective-id to 0 doesn't change the users login name. So when the remote server is contacted to do the cancel, it only looks at the login name.

my 2 cents

-- Rod Hills
There be dragons...
Paul Sperry
Honored Contributor

Re: cancel print jobs

Thanks for the input.

These are network printers.

My initent is to let this user manage
other peoples jobs. I did submit another
job as an "ordinary" user and the prntmgr
user sill could not cancel it.
Geoff Wild
Honored Contributor

Re: cancel print jobs

I was looking at the man page for super.tab - and I think you need to drop the : after printmgr:

cancel /usr/bin/cancel prntmgr@saturn

or

cancel /usr/bin/cancel prntmgr@{saturn}

http://olympus.het.brown.edu/cgi-bin/man2html?super.tab+5

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Geoff Wild
Honored Contributor

Re: cancel print jobs

Also saw this:

By default, super only changes the effective uid. Some programs (e.g. exportfs under SunOS 4.1.x) require the real uid to be root. In that case, you should put an option like ``uid=root'' or ``u+g=root'' into the super.tab file.

cancel might be the same...

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Hazem Mahmoud_3
Respected Contributor

Re: cancel print jobs

I'm wondering if adding prntmgr to the lp group would do the trick.
Also, one other option would be to use sudo. You can get that from:
http://hpux.connect.org.uk/
Then execute:
/opt/sudo/sbin/visudo to configure the sudoers file to give prntmgr access to the cancel command.

-Hazem
Paul Sperry
Honored Contributor

Re: cancel print jobs

I tried various formats of the super.tab file but sill no luck.
I did try adding the user into the lp group
but still no luck, I even added the user to the root group and it still didn't work.
I stumped
Geoff Wild
Honored Contributor

Re: cancel print jobs

In your script, did you try:


super root:cancel $cancel


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Hazem Mahmoud_3
Respected Contributor

Re: cancel print jobs

Check the permissions on the script that you are running the cancel from, or just try running the cancel command alone (not from within that script). Also, check the permissions on your cancel executable. Here is mine:
# ll /usr/bin/cancel
-r-sr-xr-x 1 lp bin 36864 Aug 16 2001 /usr/bin/cancel

Also check patches, here is mine:
# what /usr/bin/cancel
/usr/bin/cancel:
$Revision: @(#) all CUP11.11_BL2001_0816_4 PATCH_11.11 PHCO_24701
Thu Aug 16 08:44:08 PDT 2001 $

Sorry, but that's the most I can think of as of now.

-Hazem
Paul Sperry
Honored Contributor

Re: cancel print jobs

permissions and patches seem good.
have tried to run cancel fro command line and still no joy. when I tried
super root:cancel lj0-19 I got

super: Couldn't stat super.tab file `/.supertab': No such file or directory
Rodney Hills
Honored Contributor
Solution

Re: cancel print jobs

The "lpadmin" command has an option "-orc" (see man lpadmin) that is used to specify whether a user can cancel only their jobs or other users job.

HTH

-- Rod Hills
There be dragons...
Rodney Hills
Honored Contributor

Re: cancel print jobs

The "lpadmin" command also has options to specify alternate "cancel" commands for remote printers. See option "-oci".

You might have to write your own script to run "super" on the remote machine.

It might be that "super" only has effect on your local HPUX system. To cancel a job on a remote HPUX system, you might have to run "super" remotelly.

This could have potential security problems depending how you proceede.

HTH

-- Rod Hills
There be dragons...
Paul Sperry
Honored Contributor

Re: cancel print jobs

Geoff
adding uid=root in the super.tab file did the trick.

cancel /usr/bin/cancel prntmgr:@saturn uid=root

Thanks for all the input guys.
Iam glad I can "bunny" this one now and I hope
it will help someone out in the furer.