puflogh300X74.gif

Polarwave's OpenBSD
Tips and Tricks for Newbies

| Quick Printing Over SSH|

| Home | Tips and Tricks | Links | News Feeds | Fun | Contact | Blog (Opens in New Page) |


How to Print Over SSH

It can be a chore sometimes, setting up printcap files. I have samba and cups setup
on my one OpenBSD box so my windows box will be able to print there. On my other
OpenBSD box, I really don't need anything more than just the command line and my
ssh keys which I have on both OpenBSD boxes. I learned early on how easy it was to
just send the file over ssh to the remote printer:

$ cat file |ssh user@remotebox 'lpr -Prmprinter'
Doing it in a script was a little harder for me, but I figured it out:
#!/bin/sh
# script to print file to remote host over ssh
#
if [ -e $1 ]; then
cat $1 | ssh user@somebox "lpr -Pprintername"
else
echo "Input file not found - Aborting!"
fi

Now, from the command line, I type:

$ printremote.sh filename<CR>
Just be sure you have your ssh keys setup on both ends. Here are two links, one on
my site and one external link:

SSH and Samba
How to Setup Password-less SSH Using Publick - Private Keys

Cheers!

Back to Tips and Tricks
Home

Delicious Bookmark this on Delicious

No affiliation between this site and the OpenBSD project exists or is implied.

valid-html401.png