How to print from remote over SSH to local LAN printer?
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
Related videos on Youtube
casualunixer
Updated on September 18, 2022Comments
-
casualunixer almost 2 years
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.
-
Admin over 12 yearsPossible 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. -
Admin over 12 yearsThe 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."
-
Admin over 12 yearsHmm...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
)
-
-
Ungeheuer over 7 yearsHow would I do this if I were, say, in another state with my machine and trying to print to my printer back home?