6

I have the following configuration:

P == U ---------------- W

P is a HP Laserjet, connected to U, which is an Ubuntu 10.04 desktop machine with a standard gnome setup from the live cd. I just selected the HP Laserjet in the gnome printer admin and it works, I can print locally.

W is a remote windows machine, server 2003, and --- is an untrusted connection.

I wonder if I can create an ssh tunnel between U and W, so W can print using U's printer service. Which ports will I need to forward and what kind of printer must I add then on the windows machine?


EDIT: I found out I can go to http://localhost:631/ on the U machine and there is the CUPS browser gui. I will try and forward port 631 to W, and add a printer on W like http://localhost:631/printers/hp

4 Answers 4

8

Well... I'd say you can ssh your U machine and then issue the necessary lp or lpr commands. It's a bit of DIYish, but if ssh is already configured there's no need to open any ports.

Maybe this would work, from command line:

cat yourfile.pdf | ssh user@yourubuntumachine lpr

But maybe there's a quicker way... Let's see what others say.

1
  • 3
    Or, without cat: ssh user@yourubuntumachine lpr < yourfile.pdf Mar 4, 2017 at 20:35
3

I found this "how to." i think it can be your solution

HOWTO Print remotely through ssh access

From that article:

  1. Forward a local printer port to the remote printer:

    ssh -R127.0.0.1:9100:remote_printer_ip_address:9100
    
  2. Connect your remote box local port which has been forwarded; in other words, pretend that 127.0.0.1 is your printer.

1
  • In my case, the remote machine (W) is also an Ubuntu machine. For whatever reason, CUPS cannot detect the correct printer driver over the tunnel. I suspect it's using a different port to autodetect this. However, the generic/PostScript driver works well in many cases.
    – jpaugh
    Nov 6, 2017 at 19:20
1

If you have FreeNX server installed you can actually access the box in video mode with collaboration of ssh server.

This will help you in a way that you can actually view the file :) and do the stuff.

BUT THIS WILL MAKE THINGS a bit lengthier.

0

In the end I forwarded port 631 to the windows machine. I can access the cups interface in the browser of the windows machine when I go to localhost:631. I was able to add a printer like http://localhost:631/printers/hp using the add printer dialog of the windows system.

I am using autossh to forward the port, so the ssh connection is more stable.

You must log in to answer this question.

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