Use ssh-agent to automatically manage your ssh client keys
The ssh -agent is a very handy component of ssh that manages your private keys for you, passing your credentials along whenever they are required.
The ssh-agent manpage tells us the following:
ssh-agent is a program to hold private keys used for public key authentication (RSA, DSA). The idea is that ssh-agent is started in the beginning of an X-session or a login session, and all other windows or programs are started as clients to the ssh-agent program. Through use of environment variables the agent can be located and automatically used for authentication when logging in to other machines using ssh(1).
Practically, this means that with an agent running (and with properly configured ssh clients), it is possible to ssh to multiple machines without requiring a copy of your private key on each intervening machine (or typing in your password on every connection).
Assume we already have an authorized ssh key (see [Hack #66]) installed on each homer, bart, and lisa. If you ssh to each machine from your local machine, there's no problem:
rob@caligula:~$ ssh homer rob@homer:~$ exit logout Connection to homer.oreillynet.com closed. rob@caligula:~$ ssh bart rob@bart:~$ exit logout Connection to bart.oreillynet.com closed. rob@caligula:~$ ssh lisa rob@lisa:~$ exit
But what happens when we try to ssh from homer directly to bart?
rob@caligula:~$ ssh homer rob@homer:~$ ssh bart rob@bart's password: ...