How to print through SSH
From OCF Help
It is possible to print on OCF printer without, i) being logged in before a lab workstation, ii) copying files to your space on OCF. This can come in useful if you are printing remotely (say, you are in a hurry, so you just want to print from home, come by the lab and pick up your print job in 10 seconds and leave) or if you are using your laptop in OCF via Airbears. Following is a simple instruction on how to do it:
On Unix and Mac OS X
This is the simplest system to do this on. Open a command terminal, and run the following command—both ssh and cat should be installed by default installation:
ssh username@ocf.berkeley.edu "lp -" < file_to_print.pdf
The fileformats supported are: PostScript, PDF, PCL, PJL, and text, or GZIP of the formats previously mentioned. Other formats, such as word documents, need to be converted preferably to PDF, or PS. You can usually generate a PS or PCL file without additional softwares by selecting "Print to File" option. Alternatively, the following command works as well, though not as elegant as the above command.
cat file_to_print.pdf | ssh username@ocf.berkeley.edu "lp -"
On Windows
If you have Cygwin installed, then you can follow the instructions for unix after launching bash or xterm. If you do not have Cygwin installed, you will need to grab plink from here, and put it in a directory in PATH (my favorite location is C:\Windows\system32, this may vary depending on your Windows installation, such as C:\WINNT\system32).
Then, launch cmd.exe, from Start -> Run, and the run,
plink -pw your_passwd username@ocf.berkeley.edu "lp -" < file_to_print.pdf
or, alternatively,
type file_to_print.pdf | plink -pw your_passwd username@ocf.berkeley.edu "lp -"
As you can see, this has clear security implications since you are specfying the password in cleartext on commandline. One way to avoid it is by using passwordless SSH keys and running
plink -i passwdless_key username@ocf.berkeley.edu "lp -" < file_to_print.pdf
and so on.
