Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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
up vote 2 down vote accepted

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
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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