OK, so it is fairly straight forward to to run apps from a remote server on my local X screen as though they were local apps. The question is, when trying to print, the remote app only sees printers on the remote side.

Is it possible (surely it is) to port forward the local CUPS server to the remote session? If so, how? I have tried using the -L option and the printer (515) service, but to no avail.

  • Possible duplicate of SF: "Printing on a local printer from SSH remote session"; one answer there has details on SSH and mentions that -R might be what you're looking for. – sr_ Mar 4 '12 at 15:45
  • The answers for the SF question, which is on another site, do not help much either. The closest I can get is the error "connect_to localhost port 515: failed." – casualunixer Mar 5 '12 at 3:02
  • Hmm...have you tried using an unprivileged port on the remote side? (I.e. see @Gilles comment in the linked SF answer, try using ssh -R 515:localhost:5515) – sr_ Mar 5 '12 at 9:09

Seems that port 515 is for the earlier lpd implementation for Unix printing. CUPS uses port 631 for IPP printing. If one does not have root privileges, one cannot use port 631. Instead, use a port > 1024, then point CUPS at that port for printing on the local printers. Sample incantation for ssh that works for CUPS, assuming you do not have root privileges:

ssh -R 6311:localhost:631 remotehost

To test for success, assuming the administrator on localhost set up a default printer queue, issue the following command on remotehost:

lpq -h localhost:6311

Jobs can be submitted on the command line using:

lpr -H localhost:6311 files-to-print
| improve this answer | |
  • How would I do this if I were, say, in another state with my machine and trying to print to my printer back home? – Ungeheuer Feb 21 '17 at 0:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.