ITEM: BB2683L

need to restrict certain users from a queue.



QUESTION:  I would like to deny certain users from accessing a queue.

SOLUTION:

  SPECIAL NOTICES

       Information in this document is correct to the best of our
       knowledge at the time of this writing. 

       Please use this information with care.  IBM will not be
       responsible for damages of any kind resulting from its use.
       The use of this information is the sole responsibility of
       the customer and depends on the customer's ability to eval-
       uate and integrate this information into the customer's
       operational environment.

       +----------------------------------------------------------+
       |                                                          |
       | NOTE:  The information in this document has NOT been     |
       | verified for AIX 4.1.                                    |
       |                                                          |
       +----------------------------------------------------------+

FOR VIRTUAL PRINTERS:
1.  Create a backend script.  For this example, it is called
    /u/print/back:

    \#!/bin/ksh
    QUEUE=example
    DENY=`fgrep $USER /tmp/deny|wc -l`
    if [ $DENY = 0 ]
    then
        cat $1 >/dev/lp0
    else
        echo "You cannot print to $QUEUE" | mail -s "printing" $USER
        exit 0
    fi

    
    The variable QUEUE will need to be changed from example to the name
    of the queue that will deny access to certain users.

    Also, the device that the file will be redirected to will also need 
    to be changed.  In this example, this device is /dev/lp0.

2.  Change the permissions of this script so it is at least 
    executable by everybody.  

    chmod 755 /u/print/back

3.  Create a "deny" file.  In this example, the file is 
    called /tmp/deny.  This file contains the usernames
    of the users that are to be denied.  For example:

    user1
    user2
    user3

4.  go into the virtual printer:
      -type in "lsvirprt" at the command prompt
      -choose the printer
      -at the "To terminate, press Enter:" prompt, type 
       "mo=/u/print/back"
      -press enter to terminate

5.  Now, when somebody prints to this queue, and he/she is on the 
    list, the job will not print.  A mail message will be sent to 
    the user.

FOR A REMOTE QUEUE:  

1.  make another backend script.  In this example, it is called
    /u/print/remotebk:

    \#!/bin/ksh

    QUEUE=remote
    REMQ=hp4asc
    HOST=vulcan
    DENY=`fgrep $USER /tmp/deny|wc -l`
    echo $DENY
    if [ $DENY = 0 ]
    then
        /usr/lpd/rembak -S$HOST -P$REMQ $1
    else
        echo "You cannot print to $QUEUE" | mail -s "printing" $USER
        exit 0
    fi

    The variable QUEUE will need to be changed from remote to the name
    of the queue that will deny access to certain users.
    The variable REMQ specifies the queue on the remote side's 
    printer queue (the print server's queue).

    The HOST will also need to be changed.  This needs to be the 
    print server's hostname.

    Once again, make sure that the permissions on the script are 
    executable by everybody.  Also, make sure that the permissions 
    on /usr/lpd/rembak are -r-sr-x--x.  To change the permissions, 
    issue the command "chmod 4551 /usr/lpd/rembak".

2.  Create a "deny" file, if this hasn't been done already.  In this 
    example, the file is called /tmp/deny.  This file contains 
    the usernames that are to be denied.  For example:

    user1
    user2
    user3

   
4.  Stop the spooling:
    stopsrc -cg spooler

5.  vi /etc/qconfig:
    Change the stanzas for the remote queue so that it looks 
    like:

    remote:
            device = dremote
            up = TRUE
            host = vulcan
            s_statfilter = /usr/lpd/aixshort
            l_statfilter = /usr/lpd/aixlong
            rq = hp4asc 
    dremote:
            backend = /u/print/remotebk
     
4.  start the spooler
    startsrc -g spooler

5.  Now when somebody prints, and he/she is on the deny list,
    the job will not get printed.  The user will get a mail 
    message.

 


Support Line: need to restrict certain users from a queue. ITEM: BB2683L
Dated: December 1995 Category: N/A
This HTML file was generated 99/06/24~13:30:23
Comments or suggestions? Contact us