Unix Command-Line Release Station Client

In a modern Linux environment, the most commonly used print system is usually CUPS. PaperCut NG can be configured to integrate with CUPS to conveniently track printing. On Legacy Unix systems CUPS is often not an option and printing is performed via the Line Printer tools such as lp or lpr. LPR/LPD is a non-authenticated printing protocol so the identity of the user associated with a print job can't be trusted. Instead, the authentication must be performed at the PaperCut NG application layer. The PaperCut NG client tool with popup authentication as discussed at the section called “Scenario Two: The Multi-User Mac with Popup Authentication” is a good option but not appropriate for a terminal-only environment. Terminal-only environments can be supported via a release station queue (see Chapter 9, Print Release Stations for more detail). Jobs held in a release station queue are normally accessed and released via a dedicated terminal or a web browser based interface, however for the benefit of terminal-only users, a command-line job release client is also provided.

This process is best explained using an example:

  1. John uses the lp command to print a Postscript document from his Unix terminal session. The job arrives in the queue under the username identity "john". (Although the name can't be trusted.)

  2. The administrator has enabled the PaperCut NG release station on this print queue. The job is placed into a holding state.

  3. John must now authenticate, proving his identity and release the job. He chooses to do this via the command-line release station client.

  4. John enters the command release-print-job. This command was set up by the system administrator.

  5. John enters his username and password, confirms the job's name, cost and page count and releases the job for print. The following is an example of the output seen:

        Please enter your username: john
        Please enter your password:
        Current balance: $8.00
        18:04:13 - Name: "Configuring Linux", Pages: 2, Cost: $0.40
        Print this job? [yes]
        Released 1 job(s).
                        

  6. The job prints and John's account is charged.

Enabling the release station on a printer is a global option - it affects all jobs from all users. In some environments it may not be appropriate to have all jobs controlled via a release station - for example, jobs originating from Windows systems are already authenticated and should print directly. An alternate strategy is to have two queues for the same printer. The first queue does not use the release station option and only allows printing from authenticated workstations/users, while the other queue has the release station option enabled.

PaperCut NG managed print queues can be exposed for access via LRP/LPD using various methods. The optional Windows system component, "Print Services for Unix" can be used if the queues are hosted on a Windows system. An LPD interface is available for CUPS if the queues are hosted on Linux.

Tip

Windows system administrators can control which queues are exposed via LPR/LPD by setting printer permissions. Queues set up to explicitly deny permission to access from the SYSTEM account will not be accessible via LPR.

Installing the Command-Line Release Station Client

The following installation instructions assume the reader has prior Unix system administration experience.

  1. Ensure that Java 1.5 or newer is installed on your system. To check, type java -version at the terminal. If you do not have Java 5 (1.5) or higher, please install it before continuing. Java is available for all major Unix operating systems.

  2. Copy the release station files from your primary server to the system for which you wish to set up the command line release station client. These can be found in [app-dir]/release. If your primary server is running Windows, this folder will be shared by default (accessible via //[server]/release). You may be able to use tools such as Samba (smbclient) to help copy these files. Ensure all files in the folder are copied taking care to preserve the existing heirarchy.

    The recommended location to install the release station command line client is /usr/local/papercut/release/.

  3. Ensure that the command line release station client has execute permissions for all users. This can be achieved with the following command when in the release directory:

        chmod 755 ./pc-release-cmd-line.sh
                                

  4. For convenience, an alias can be created for the command line release station client. This is typically done by entering the following line in a global profiles file, or each user's .profile file:

        alias "release-print-job" = \
            "/usr/local/papercut/release/pc-release-cmd-line.sh
                                

  5. Users will now be able to release their print jobs by typing release-print-job.

It may also be useful to create a 'wrapper' for lp to run the command line release station client after a user has sent a print job. The following script print-doc provides an example:

    #!/bin/sh
    echo "Printing document using lpr..."
    /usr/bin/lpr "$@"
    echo "Printing done, calling program to release job..."
    sleep 1
    cd /usr/local/papercut/release
    ./pc-release-cmd-line.sh
    echo "Done."
                    

For the convenience of users, the command line release station client should be installed on all systems where printing from the terminal may be performed.