Managing Users and Printers on the server cups.cs
This document is addressed to those who are responsible for adding users
to the PYKOTA print accounting system albeit you may want to refer to
CupsCsServer if you encounter problems. Furthermore, all of this was
done on Ubuntu based Linux systems.
Introduction
The hostname
cups.cs
is a CNAME.
You can login to the host using your core.cs regional UNIX password.
You must login from cscfnet, otherwise, you will be denied access. Check
the file
/etc/hosts.allow
for the current access configuration.
Pykota and Cups
The host
cups.cs
has CUPS (Common Unix Printing System) and Pykota
installed on it. The Pykota system is a print accounting system with
many features.
Anyone in the Unix
pykota
group can run Pykota commands. To check
whether you are in the groups type
groups useruserid
. You should see
pykota
listed. If this is not the case. Please have a system administrator
add you to the group (not currently managed by our accounting system).
Note about userids
For both Macs and Windows it may be
necessary to make the userid of the current login match their UWuserid. Both OSes tend to silently transmit that information when connecting to a printer. Since all of our quotas are controlled by the UWuserid it will generally only work if they match. For notes on changing the Mac userid, see:
ChangeMacShortName
Adding a user to the Users Database
Adding a user to the users database does not mean that user will be able to print
but merely makes it possible to add them to a Pykota managed print queue.
If the user
xyz
does not exist in the database, then
pkusers --list xyz
yields
pkusers --list xyz
/usr/bin/pkusers : There's no user matching xyz
whereas if the user exists in the database one gets something like
xyz - <xyz@uwaterloo.ca>
Limited by : quota
Account balance : 0.00
Total paid so far : 0.00
Overcharging factor : 1.00
To add the user
xyz
to the users database run
pkusers --add xyz
Adding and deleting users from a print queue
Determine whether a user has been added to a print queue
To see whether a user
xyz
(remember just because a user is in the database does not mean
they have been added to any print queues!) belongs to a print queue
ABC
run
edpykota --list --printer ABC xyz
It is required that the user has been added to the Pykota database as described
above. Remember this does NOT mean they can print!
Adding a user to a print queue
Given a user
xyz
that exists in the users database and a print queue ABC
that exists in the print queue database we want to add the user
xyz
to
ABC
. We
accomplish this by running
edpykota --add --printer ABC xyz
The default behaviour of this command is to allow the user to print
as many pages as they want as often as they want. Accounting on how much
they print will be done. It is possible to change this behaviour in subtle
ways that will describe as the need arises later in this document.
Remove a user from a print queue
To delete the user
xyz
from print queue
ABC
run
edpykota --delete --printer ABC xyz
Check for conflict with CUPS "Set Allowed Users"
CUPS has a native (not part of pykota) facility to allow or deny a list of users.
For each printer listed by
http://cups.cs:631/printers/ , there is a button labelled "Set Allowed Users".
If there are any users in the allow or deny lists, anyone attempting to use the printer must first pass this hurdle before pykota is asked whether they can print.
This is easy to miss and sure to cause confusion.
So, make sure the "Set Allowed Users" list is empty when using a printer with pykota.
Displaying a user's quotas
The command
repykota
is quite useful for this purpose.
Typing it without any options and piping it through
less
is instructive,
that is, type
repykota|less
. Some examples usages are given by:
repykota --printer lp
will print the quota status for all users who use the lp printer
and
repykota --printer "laser*,*pson" jerome "jo*"
will print the quota status for user jerome and all users whose name begins
with "jo" on all printers which name begins with "laser" or ends with
"pson".
Refined manipulation of user's quotas per print queue
Suppose user
xyz
is in the user database (see above for definition) and assume we have
added them to a print queue
ABC
(see above for how to do this). Suppose instead of allowing
unlimited printing we want to limit them to a fixed number of pages, say an upper bound of 550 pages
(not to be exceeded, also known as a
hard limit) and and a lower limit of 500 (can be exceeded a bit, known
as a
soft limit) pages. Then we do
edpykota --printer ABC -S 500 -H 550 xyz
If we run
repykota --printer ABC xyz
we should see
repykota --printer ABC xyz
Report for user quota on printer ABC ()
Pages grace time: 7 days
Price per job: 0.000
Price per page: 0.000
User overcharge used soft hard balance grace total paid warn
-----------------------------------------------------------------------------------------------
xyz -Q 1.0 7 500 550 0.00 7 0.00 0
Total : 7 0.00
Real : 753
Notice that we could charge a price if we wanted to. Ultimately the man page of the command
edpykota
is authoritative. Having said
that, we hope to provide instructive examples in this wiki that will cover all cases as they come up.
If one wanted to set the Soft and Hard limits for all users on a particular printer use:
edpykota --printer ABC -S 500 -H 550
This will not zero everyone's current print count, just set their limits.
Adding a Print Queue to Pykota
We assume that a system administrator has Pykota
enabled the print queue, see
CupsCsServer#A_necessary_pre_condition_for_PY for the details if the commands
below do now work.
The command
pkprinters
is used to add and delete pre-existing CUPS print queues
to Pykota's database. It has a command line syntax that is very similar to that of
pkusers
, in particular we can find out whether
ABC
exists by running
pkprinters --list ABC
If Pykota claims to be not aware of the print queue, you can add to Pykota by
by running
pkprinters --add ABC
It is highly likely that a UNIX system administrator will have already
done this step but for reference sake we include a note here, see
CupsCsServer#A_necessary_pre_condition_for_PY for an important caveat if you encounter difficulties with the command below.
External References