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, 2012 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." Mar 5, 2012 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, 2012 at 9:09

1 Answer 1


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
  • 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, 2017 at 0:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .