Automating SSH and FTP

Automating SSH Login

SSH is generally happy accepting a hash key instead of username and password, provided you can generate your keys, and get your public key placed on the destination host. What’s ironic here is that doing things the “simple” way in Windows, in a GUI, is actually kind of elaborate, while doing it the “hard” way from the command line in Linux or Unix is pretty darn easy.

If you’re stuck on the Windows side, Leo Notenboom (“Ask Leo!”) has a nice guide to generating your keys using various GUI tools at

If you are working in Linux you can directly specify RSA or DSA keys as part of your keygen command. A truly fine example using DSA by Vivek Gite is at

Automating FTP Transfers

And Leo has a more advanced how-to at

Notice in all of this that Leo suggests using no passphrase, while Vivek shows a more sophisticated solution.

CAVEAT: see what actually works on your target system!

HP-UX Printer Management

HP-UX Printer Management

First, a warning: if you’ve been looking at the Linux printer information elsewhere on this site, stop (unless you’re interested in Linux). Here’s why:

HP-UX is a System V Unix. Thus it uses lp rather than lpr as its print facility (unlike Linux, for instance.) See this HP IT Resource Center thread for more on this subject.

Administrators can consult The HP-UX System Administrator’s Guide for a thorough discussion, “Administering the LP Spooler.”

Geeks will like the AIX/HP-UX Interoperability Guide for a deep technical discussion of print operations under HP-UX:

Users seeking simple answers should check below. If you’re a user, rather than a sysadmin, what printer management you do will likely be entirely from the command line.

Task Command Examples/Comments
Print to your default printer lp document

What happens:
the shell returns a printer name and a job number:


Print to another printer lp -dprinter_name document There must be no space between the -d (destination) and the printer name.
List your print jobs /usr/bin/lpstat Use this to list your print jobs and their request ID, for instance to cancel one.
Cancel a print job /usr/bin/cancel job_number The print job number looks like:
Cancel all print jobs for your user on a specific printer /usr/bin/cancel -a printer_name A user can only cancel their own jobs, unless they’re superuser.
Determine lp spooler status /usr/bin/lpstat -r

What happens:
the shell returns the spooler status:

spooler is stopped

Display lp spooler activity statistics lpana Only useful to sysadmins
Alter a print request lpalt See the man page for details.
Set a default printer setenv PRINTERDEST=”printer_name You should set this in your profile files.
Allow print requests to be submitted to the request directory of a printer /usr/lib/accept printer_name This “turns on” the print queue for a single printer.
Refuse to allow print requests to be submitted to the request directory of a printer /usr/lib/reject printer_name
Enable a printer to actually print /usr/bin/enable printer_name This enables literal printing on a single printer.
Disable a printer from printing /usr/bin/disable printer_name
Start the lp spooler (the scheduler) /usr/lib/lpsched This starts actual spooling, i.e. job scheduling and processing.
Stop the lp spooler (shut it down) /usr/lib/lpshut
Printer Directories
Printer Descriptions Directory /etc/lp/*
Printer Spool Directories /var/spool/lp/*



Hewlett-Packard’s 64-bit Unix is everywhere in medical environments. If you’ve had an MRI, an MEG or a CAT Scan, it’s likely your images were managed and viewed on an HP-UX workstation.

HP-UX is a System V (as opposed to a BSD) Unix. Mac’s OS X, on the other hand, is a BSD derivative, while you can think of Linux as BSD-like in many of its functions, such as printing. The current version of the OS is 11i (or 11.11), which comes in various flavors such as the Critical Operating Environment version used in medical record storage. Older version 10 workstations are still around, sometimes for application compatibility.

Generally, I’ll keep HP-UX-specific materials here, while most other general Linux and generic Unix issues will live under the GNU/Linux heading.

Feel welcome to add to this information by commenting below.