Operating System - HP-UX
1834018 Members
2593 Online
110063 Solutions
New Discussion

prevent user from printing

 
SOLVED
Go to solution
S.C. Fun
Advisor

prevent user from printing

Hi all,
How could I prevent normal user from printing to a particular print queue in the LP spooler?

Thanks in advance.
5 REPLIES 5
Heinz Gaertner
Advisor

Re: prevent user from printing

Hi,

as far as i know there is no spooler functionality to do this.
A trick could be to move your lp-command and set a script at the original place which could check the user-id. If it's a allowable user then it can give all options and the file to print on to the original lp-command.
Armin Feller
Honored Contributor

Re: prevent user from printing

You can modify the standard interface scripts to check if a "user" is allowed to print or not (send a mail if printing was refused).
Armin Feller
Honored Contributor
Solution

Re: prevent user from printing

Hi,

here what you can do:

# vi /var/spool/lp/interface/

and insert following:

user=$2
if [ $user = "arminfeller" ]
then
exit 0
fi

Please put this directly under the line:

#!/usr/bin/sh

This will cancel each printjob to this printer which comes from the user named arminfeller.

Best regards,
Armin
Steven E. Protter
Exalted Contributor

Re: prevent user from printing

I just reset the guys password, though HR or management usually gets annoyed.

:-)
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Chris Vail
Honored Contributor

Re: prevent user from printing

If this was a common practice at your organization, you might want to create a printers.deny file. Put in it the usernames that you want to deny access to particular printers--one line each, with username and the printers that they will be denied access to:

DPATH=/etc
DFILE=printers.deny
IAM=`echo $0|awk -F\. '{ print $2 }'`
if test -f $DPATH/$DFILE
then
LINE=`grep $USER $DPATH/$DFILE`
DUSER=`echo $LINE|awk '{ print $1 }'`
DPRINTER=`echo $LINE|awk '{ print $2 }'`
if test "$DPRINTER" = "$IAM"
then
echo "Access denied to $IAM"
exit 1
fi
fi

This could be added to any and all scripts in /etc/lp/interface.

Good luck
Chris