-
Notifications
You must be signed in to change notification settings - Fork 3
Home
When your printer is connected to your SSH server, but not to you, you can use sshlpr2 to create a CUPS printer that behaves like a remote server.
Similar work was done by Andre Masella. His original sshlpr script can be found at
http://www.masella.name/technical/sshlpr.html
The original version of sshlpr has two problems:
-
Requires your SSH server to accept public key authentication. Password authentication will certainly fail, because when ssh is run by CUPS, it is not able to open a terminal.
-
Requires CUPS to run su, which will also fail because CUPS is not connected to a terminal.
To avoid the su problems, sshlpr2 has a simple server daemon that accepts jobs submitted to it (via the sshlpr backend) and forwards the jobs to clients attached to it (via sshlpr_client).
sshlpr_client can be run in an X environment, so that you can launch xterm and key in your password. sshlpr_client is setuid lp, in order to allow you to connect to sshlprd.
On a regular Ubuntu system, type:
$ ./configure; make; sudo make install
If you are on other Linux/Mac system, have a look at the configure options specific to sshlpr2:
--with-cups-backend CUPS backend directory, e.g. /usr/lib/cups/backend --with-socket-dir Socket directory, e.g. /var/sshlpr --with-lpuser Username to setuid the CUPS backend and client
After installation, create a printer based on the sshlpr2 backend, in the form sshlpr://<username>@<servername>/<printername>, e.g.:
sshlpr://[email protected]/Pem_CC_1_BW
Unlike the original sshlpr, the local user does not have to be specified, because you will always execute ssh as the user that created the print job.
For driver, use Generic PostScript Level 1 Printer Foomatic/Postscript1 (recommended)
.
-
Initialization
- sshlprd is running
- Some user runs sshlpr_client, which connects to sshlprd
-
sshlpr
- Creates a FIFO in /tmp
- Submits job request to sshlprd
-
sshlpr_client
- Receives the job request from sshlprd
- Executes sshlpr_helper, passing parameters from the job request to sshlpr_helper
-
sshlpr_helper
- Reads the parameters
- Starts an xterm process that:
- Reads from the FIFO, and pipes the output to...
- ... an ssh process that runs the ...
- ... lpr process on the remote end
To discover your list of printers:
ssh <CRSID>@linux.pwf.cam.ac.uk 'lpstat -P -a'