Create print quota usage reports with repykota Last modified on $Date$ To account for print usage is good, however there must be a way to easily query the print quota database and generate reports describing current usage for every user on every printer. Command line based Print Quota reports PyKota features a quota report generator, named repykota, with which you can print the current state of the quota database. repykota behaves differently when it is launched by a PyKota administrator, compared to when it is launched by a normal user. In the first case, the print quota report will contain current account balance, soft and hard limits, number of pages printed since last reset, total number of pages printed, total paid, for possibly all users or all groups, depending on command line options. In the second case, i.e. when repykota is launched by a normal user, the user will only be allowed to see informations about himself or the groups he his a member of. Any user can limit the report to only one or more printers, by specifying the -P or --printer command line option, followed by one or more printer name or wildcard. If more than one printer name or wildcard is used, they must be separated by commas. Launching repykota with no arguments will generate a complete print quota report, depending on what you are allowed to see. Use the --help command line argument to learn what are the different command line options available. Reference repykota -v--version -h--help -u--users -g--groups -P printername --printer printername name1 name2 ... nameN Web based Print Quota reports PyKota also features a CGI script to remotely access to print quota reports with a web browser, it is called printquota.cgi and you can put it in your web server's cgi-bin directory if a web server is installed on any machine on which PyKota is also installed and configured correctly. You may also want to copy the CSS stylesheets which are present in the stylesheets/ directory to your web server's DocumentRoot (e.g. /var/lib/www) so that the CGI script can find them to present a nicer web interface. You can find printquota.cgi in the pykota/cgi-bin directory. Here's how to install it, provided that your web server's cgi-bin directory is /usr/lib/cgi-bin : port50-2:/home/jerome/pykota$ cp cgi-bin/printquota.cgi /usr/lib/cgi-bin port50-2:/home/jerome/pykota$ chmod 755 /usr/lib/cgi-bin/printquota.cgi Note Please ensure that the user your web server is run as, for example www-data under Debian, is allowed to read ~pykota/pykota.conf but for security reasons you must ensure that this user is not allowed to read ~pykota/pykotadmin.conf If you install the CGI script as described above, any user will be allowed to view the complete print quota report, for all users, groups and printers. This is then a different behavior compared to when a normal user wants a print quota report from the command line through repykota. If you find this disturbing, then the best is to ask for user authentication whenever the printquota.cgi CGI script is accessed. This CGI script will then automatically behave as expected, showing in the print quota report only what the authenticated user is allowed to see, just like when he launches repykota from the command line. As a special case, if the user authenticates using the root username, then there's no restriction on what may appear on the print quota report. To automatically ask for an authentication dialog whenever the CGI script is accessed, you have to configure your web server to do so. If your webserver is Apache, then it's relatively easy. First you have to put printquota.cgi in its own subdirectory below your web server's cgi-bin directory, for example in cgi-bin/PyKota/. Then use the htpasswd command line tool to create a file which contains usernames and passwords for all your users allowed to see the print quota report from a web browser, and put this file outside of the directories served by Apache so that nobody could retrieve it. Finally create a file named .htaccess in cgi-bin/PyKota/ with appropriate content in it. This file should tell Apache to automatically ask for an authentication whenever something from this directory is accessed, and to use the password file previously created to match usernames and passwords. You may also have to tweak Apache's default configuration to allow the authentication mechanism. The detailed procedure to do all this is out of the scope of the present document, please refer to Apache's documentation for all the gory details.