
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Intermediate and Advanced SSH
|
137
Note that such a cut and paste will work in any xterm, but for it to work at a tty
(text) console, gpm will need to be running. An alternative approach is to redirect
ssh-agent’s output to a file, make the file executable, and execute the file within your
current shell’s context (Example 4-6).
Once ssh-agent is running and
SSH_AUTH_SOCK and SSH_AGENT_PID have been declared
and exported, it’s time to load your private key. Simply type ssh-add, followed by a
space and the name (with full path) of the private key you wish to load.
You can use ssh-add as many times (to load as many keys) as you like. This is useful
if you have both an RSA and a DSA key pair and access different remote hosts run-
ning different versions of SSH (i.e., some that support only RSA keys and others that
accept DSA keys).
Passphrase-Less Keys for Maximum Scriptability
ssh-agent is useful if you run scripts from a logon session or if you need to run ssh
and/or scp repeatedly in a single session. But what about cron jobs? Obviously, cron
can’t perform username/password or enter a passphrase for PK authentication.
This is the place to use a passphrase-less key pair. Simply run ssh-keygen as described
earlier, but instead of entering a passphrase when prompted, press Enter. You’ll proba- ...