Operating System - HP-UX
1830696 Members
2887 Online
110015 Solutions
New Discussion

How to set rights for printers

 
Rene_17
Regular Advisor

How to set rights for printers

Hi !
How can I set rights for printers ?

- one group of local users should access the local printer
- one group of local users shoudn??t access the local printer

Please help me !
7 REPLIES 7
Bill Hassell
Honored Contributor

Re: How to set rights for printers

There is nothing in the spooler system to limit access to a particular printer. You will have to add code into each printer's script to reject users that do not have rights to the printer. The userID for each job is the $1 parameter.


Bill Hassell, sysadmin
Geoff Wild
Honored Contributor

Re: How to set rights for printers

Yeah, if they print from unix, you would have to write your own "wrapper" script to intercept the lp command. Probably put the users in 2 different groups then have a case statement to decide if they are allowed to print or not.

But once they figure out that lp is wrapped, then all they need to do is more the script to find out how to by pass it...

If it's from an application - then you have more control....and use the same wrapper script...

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.
Massimo Bianchi
Honored Contributor

Re: How to set rights for printers

Just an idea: an lp interface it's only a shell script.


Adding up this and Bill hint: write some lines in the lp interface script.

If the uid belongs to group a, then print normally
If the iud belongs to group b, then do nothing.

Simple, no ?

Massimo

Rene_17
Regular Advisor

Re: How to set rights for printers

I have added these script to my file Lex1275 in /etc/lp/interface directory:

#!/bin/sh
# Which group do you belong to?
ID=$(id -gn)
case $ID in
iff_stud) echo "Permission denied"
exit 1;;
*) echo "Access granted" ;;
esac

I have tested the file in another file but it dosn??t work ?
Massimo Bianchi
Honored Contributor

Re: How to set rights for printers

Hi,
following is an example of parameters sent by lp to the printer:

filetest2-1908 orat01 1 /var/spool/lp/request/filetest2/dA1908itsap04



second column is the owner: orat01.

You can chacnge your check from UID to the string and match/not match the users you do not want to print.

$2 is the key, not $3 !!

Massimo
Rene_17
Regular Advisor

Re: How to set rights for printers

the question is what script should i use to add the lines ?:

/etc/lp/interface/Lex1275 ?
/var/spool/lp/request/* ?
/etc/lp/member/... ?
Massimo Bianchi
Honored Contributor

Re: How to set rights for printers

in

/etc/lp/interface/Lex1275

assuming that Lex1275 is the driver.

I paste my dummy file, i sued to extract that infos.

This is my filetest2 dummy printer, in /etc/lp/interface/filetest2

#!/usr/bin/sh
PATH="/usr/bin:/usr/lib"
export PATH

copies=$4

echo $* > /tmp/massimo.info
echo $1 $2 $3 $4 $5 $6 $7 $8 $9 >> /tmp/massimo.info

shift; shift; shift; shift; shift
files="$*"

i=1
while [ $i -le $copies ]
do
for file in $files
do
cat "$file" 2>&1
echo "\012\c"
done
i=`expr $i + 1`
done


Massimo