Ssh – adding remote ssh printer as local printer

printingremotessh

I have SSH access to a remote host (FreeBSD) that has a printer set up.
I do not have root access on that host or any other special user rights.
Now I want to print directly from my laptop on that printer (Ubuntu 10.10).
The problem is that I don't know how to "import" or whatever the the printer, as it needs authetification from my user account (print quota limitations).
E-mailing me the files I want to print or scp them every time is a pain, ATM I pipe the PostScript output manually to a ssh command, but that's also a huge working overhead.
E.g. when I want to print a foo.pdf

pdftops '/path/to/foo.pdf' – | ssh user@remotehost 'lpr -P printername'

So, does anyone know of a smooth way to shorten this procedure? Ideally I would just want to use a printername instead of the whole ssh command

Best Answer

Why is piping a huge overhead? Because of the typing?

Just put your command in a small script/function/alias and create a passwordless ssh key and add the public part to the remot ~/.ssh/authorized_keys and it will become probably much easier.

You could also use a ssh key with password and cache the password using

ssh-add ~/.ssh/your_private_key

So you have the security of a key with password but don't have to type it every time.

Another way would be to create ssh tunnels to the right ports. ssh -L ... would do it, read man ssh. You can also add this tunnels to your ~/.ssh/config using LocalForward so you create a connection with this port tunnels already defined.