Printing to Lab Printers from Dorms/Home
Printing
Students at Pitt can print 900 pages per semester in any of the campus computer labs. Unfortunately, that means running down to the lab, logging in to a computer, opening what you want to print, telling the computer to print, waiting for your turn in the printer queue, and then waiting for the Pitt lab employees to bring the printout over to the table for you to pick up. Ideally, the printers in the computer labs would be accessible from our own computers in our homes or dorms as options when we want to print something. I have created a Linux printer "driver" to make this possible, and I have also posted some instructions on how users of other operating systems can print from their rooms in a few steps.
Linux Printer "Driver"
Installation and Setup
Gentoo ebuild
If you're using Gentoo and don't mind dealing with Portage overlays, you can download a Gentoo ebuild and throw it in your overlay, probably under net-print
. Pitt users will want to set the pitt
USE flag so that the ebuild will install a Pitt printer–setup script you can run to add all the campus printers easily. The ebuild will pull in CUPS and Expect if necessary. Just emerge sshlpd
and follow the post‐install instructions for information about how to add the printers.
Manual Installation
If you don't run Gentoo or don't want to bother with a Portage overlay, you can install sshlpd
manually.
Install CUPS
Gentoo users can emerge cups
. Take note of where CUPS installs its backend files. This may be /usr/lib/cups/backend
, /usr/local/lib/cups/backend
, /usr/libexec/cups/backend
(the default directory under Gentoo), or some other directory.
Install and Set Up My SSHLPD script
First, you need Perl and OpenSSH, but if you have Linux, you're pretty much guaranteed to have them. You also need the Perl module Expect.pm, which you can get with cpan
or, under Gentoo, with emerge Expect
(note the capital E). Now download SSHLPD, and as root
, copy it to the CUPS backend directory. Also, issue the command chmod 755 sshlpd
on the file to make it executable. Finally, you'll need to save your password to a file for sshlpd. Create the directory /etc/sshpassword/
, and in it create a file of the form username@unix.cis.pitt.edu
, where username is your Pitt username. The file should contain one line, the password for your Pitt account. So that no one else can read your password, change the owner of the file to the username used by CUPS (lp
on Gentoo) and change the permissions to 0600. If you don't know the CUPS username, change the file owner to root
and the permissions to 0600 and look for the error message in the log file (see Troubleshooting below for how to set up logging) when you try to print. The error message will tell you the proper username.
Start CUPS
Under Gentoo, you can run /etc/init.d/cupsd start
, and, to make it start whenever your computer boots, rc-update add cupsd default
.
Open the CUPS Administration Page
Really, you could do this from the command line, but I have barely used CUPS, so I don't feel qualified to give advice about its command‐line interface. The web interface is probably located at http://localhost:631/. If not, check your CUPS config file, which is probably /etc/cups/cupsd.conf
or something similar, for a line like Listen localhost:631
for the proper address.
Add the Printers You Want
- Click Add Printer.
- Fill in anything you'd like for Name, Location, and Description. I'd suggest a short name like "CL" for Name and something like "Cathedral of Learning" for Location and Description. Then press Continue.
- For Device, choose LPD over SSH Login. Press Continue.
- For the URL, you want
sshlpd://username@unix.cis.pitt.edu/xxx
, where username is your Pitt username and xxx is the printer name taken from one of the printer‐name lists below. Press Continue. - Choose Generic for the make of your printer, and press Continue.
- Select "Generic PostScript Printer Foomatic/Postscript (recommended) (en)" as the printer type. (You do not need to install a separate Foomatic package for this driver to exist (at least, not under Gentoo).) Press Add Printer.
- You will probably be prompted for a username and password. Your root username and password should work. (This is not asking for the username you use to log in to unixs.)
- You may be prompted for Print Options. If not, you may click on the printer name to bring up its page and then click "Set Printer Options." Page Size is US Letter. Double‐Sided Printing you can turn on if you like; you may also be able to turn it on from the Print Options of the program you are printing from if you want it. Everything else should be fine. Press the Set Printer Options button in the General section once you've made the paper‐size change.
- Click on the printer name when the web interface tells you it has been configured.
- You may try Print Test Page if you'd like; if it works, you're set. It most likely will not work yet, but there are probably only a few simple adjustments required. The
sshlpd
script can tell you in more detail what those adjustments are, so check out the Troubleshooting section below to find out how to see its output.
Troubleshooting
I have tried to make sshlpd
's error output verbose so that troubleshooting is easy, but it's difficult for me to know how well it will work on other people's computers. If you are having problems, the best thing to do is to change the CUPS log level to debug. To do so, open the CUPS configuration file (likely /etc/cups/cupsd.conf
), and insert or change the LogLevel option to say LogLevel debug
. Try printing again afterward, and then check /var/log/cups/error_log
(or whatever your CUPS log file may be). CUPS output is verbose, so it may help to search for sshlpd
.
Non‐Pitt Users
I was surprised to hear from someone outside of the university who found a use for sshlpd
. The code is designed to be fairly general, so if you need LPD over SSH, you may find the script useful. There are, however, a couple of changes that need to be made.
- The location of
lpr
on the remote computer is hard‐coded. You must edit$REMOTE_LPR
in thesshlpd
script to point to thesshlpd
executable. I should find a better way of doing this, but nothing immediately came to mind, so you'll need to edit the Perl script for now. - The company I heard from uses SSH key‐based authentication, which allows SSH connections to be securely created without requiring the user to enter a password at each connection. (Ideally the Pitt version would function this way, but it appears that the university has turned off key‐based authentication on the server.) In any case, key‐based authentication makes Expect,
/etc/sshpassword
, and a little bit of Perl code unnecessary. If you have key‐based authentication set up and want to usesshlpd
, then you will want to install Stephen DeGabriele's patch to remove Expect password‐handling.
Manual Printing
Step 1: Print to a PostScript File
On my Linux machine, I have a generic PostScript printer driver already installed; it may have come with CUPS. I understand that Macs have a similar driver, though I don't know the name; look for "PostScript." Windows users can get a Generic PostScript driver by following Corey Bonnell's instructions. Once it's installed, you can choose File | Print or whatever and then choose the generic PostScript driver and "Print to File" to create a PostScript file. Save it wherever; you'll be moving it in a moment.
Step 2: Copy the PostScript File to Your Unix Accout
There are a number of ways to do this.
- One way to do this is with an FTP client. I don't know which to recommend, but FileZilla works. The server to connect to is
unix.cis.pitt.edu
. Copy your file to the server, and you're set. - Personally, I use the
scp
, part of OpenSSH, to copy the file. The following command will do the job (note that the colon is part of the command): scp filename.ps unix.cis.pitt.edu: - If you have OpenAFS set up, then you can simply save the PostScript file in your AFS space. This is the same place that FTP or SCP would put it.
Step 3: Print the PostScript File from unixs
Log in to unix.cis.pitt.edu
using an SSH client. Windows users probably want PuTTY (direct link to download), which they should run, type unix.cis.pitt.edu
into, and press Open in; Linux users probably have ssh
already installed. Then issue the command lpr -Pprinter filename.ps.
printer must be a printer defined in the file /etc/printers.conf
on unixs
. I have tested a few printers myself, and I have taken some educated guesses at the other lab printers:
Verified Printer Names
- CL
- Cathedral of Learning ground‐floor labs
- MT
- Alumni Hall (old Masonic Temple) basement labs
Probable Other Printer Names
- BEH
- Benedum Hall labs
- DLH
- David Lawrence Hall labs
- FQ
- Posvar Hall (old Forbes Quad) labs
- HL
- Hillman Library labs
- SH
- Sutherland Hall labs
There are hundreds of printers listed in /etc/printers.conf
, but most of them aren't in the student computer labs, so they aren't of interest here.
Corey Bonnell's Web‐Based Printing
Warning: Neither I nor the University of Pittsburgh can vouch for the safety of this web‐based printing system. Your connection is not encrypted, and we cannot see the source code. I'm supplying a link here because the system looks useful, but I take no responsibility for any problems it may cause.
Corey Bonnell has set up a web‐based printing system that can print PostScript and PDF files. He also provides instructions for how to create those files under Windows, Mac, and Linux. His web page combines steps 2 and 3 from my instructions and doesn't require you to manually use a command line or FTP program.
Viewing Your Printing History
View your last 10 print jobs. This can be useful to verify that your attempt to print something was actually successful.