How to cancel print job by other user? + more problem

My print job on unix submit by user "applae3". I want other user cancel job of user applae3.

I know user can cancel job by owner and root user. But In this case,

I want give response for cancel print job to user "ctrlprt".

Because I will force user "ctrlprt" use only menu(create by shell script) automatic after him login(in .profile).

For these purpose, I'm setting in .profile of user "ctrlprt" to

HOME=/export/home/ctrlprt

$HOME/menu.sh

exit

and my 2 shell script

1. menu.sh (It's call cancel_prt.sh)

2. cancel_prt.sh

echo "Enter printer name \c"

read j

for i in `lpstat -o $j|awk '{print $1}'`;

do

/usr/bin/cancel $i

done

After I'm login to user ctrlprt. It's can use menu, But can't cancel job (Permission denied).

Then, I'm use RBAC feature (BigAdmin Submitted Article: Custom Roles Using RBAC in the Solaris OS)

for set permission like root on "/usr/bin/cancel" to role "prt_r" and give role to user ctrlprt.

I'm testing by login to user ctrlprt --> login to role prt_r --> test cancel printjob --> result it OK.

However, I still can't get my objective. I found 2 problem:

1.If user ctrlprt want to cancel role. He must login to role prt_r first. (I add "su - prt_r" in first line of cancel_prt.sh)

Then, It's not automic. User ctrlprt must enter password. How to bypass this operation?

2.After login to role prt_r, user ctrlprt can cancel printjob by use command line /usr/bin/cancel.

but If call shell script cancel_prt.sh (which is have same cancel command (see script above)), It's can't cancel (Permission Denied). Why? and How to do solve?

Please suggest me...., I'm a beginner of Unix Administrator.

Thank you very much.

[1829 byte] By [aplus2u] at [2007-11-26 11:10:38]
# 1

Hi,

I can only help with the first problem.

Assigning the role prt_r to the user ctrlprt will *always*

require a password check -- you can't prevent that.

Instead, you could check the *profile* that is assigned to

the role prt_r, and instead assign that profile (those profiles?)

to the ctrlprt user directly.

Then the ctrlprt user will be able to run

$ pfexec /usr/bin/cancel

without having to provide a password.

usermod --P <profile name goes here> ctrlprt

will assign the profile direct to the user.

hth!

kidari at 2007-7-7 3:25:09 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 2

OK, Now I can solve first problem,

but I must enter command.

pfexec /usr/bin/cancel jobxxx

If enter only command

cancel jobxxx

It's still permission denied.

Amm, But It's ok for enter full command.

Thank you very much,

And.... wait more answer for second problem.

Thank again :)

aplus2u at 2007-7-7 3:25:09 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 3

I'm glad that worked.

Does the pfexec /usr/bin/cancel still fail in the script?

If so, then I hope you won't mind me suggesting that the reason

so few people have viewed this topic is that subject is a little

misleading.'How to cancel other user's print jobs' sounds

like a very simple problem (if you are root, use cancel; if not,

you can't), so many readers will just think believe -*wrongly* -

that you are asking the forum instead of reading the manual,

and so ignore the question.

It may help if you re-post the same topic with a subject like

'RBAC and scripts': that is much more likely to interest someone

who knows about RBAC. I don't think the problem is with the

cancel command, but with the way profiles interact with scripts.

Please don't be offended by this suggestion. I am sorry if you are.

cheers,

kidari

kidari at 2007-7-7 3:25:09 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 4
Thank you for your suggestion, I think you true.Running pfexec in script no problem.Thank you again. :)
aplus2u at 2007-7-7 3:25:09 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...