Configuring SSH, ssh-agent, and keychain for passwordless
Don't run keychain on a untrusted machine.
ssh-agent is used to cache your decrypted private keys so you don't
have to type in your passphrase everytime you ssh, just when when first
login. There are some limitations that keep us from using it by itself,
like for cron when your not logged in.
To learn more about ssh-agent and its limitations read Daniel
Robbins article at IBM.
keychain is a ssh-agent front-end. It keeps a copy of ssh-agent
running all the time, even when you logout. Useful for cron. I
am not going to explain how ssh-agent and keychain work. The article
linked above has an excellent explaination.
This installation comes with SSH enabled. ssh-agent comes
I am currently using DSA authentication. Create a DSA key pair
and copy the public key to the server you need to access.
$ ssh-keygen -t dsa
$ scp ~/.ssh/identity.pub remotehost:~/.ssh/authorized_keys2
accually append it to the end
if ~/.ssh/authorized_keys2 already exsits
# cd /usr/ports/security/keychain
# make install
$ vi ~/.bash_profile
~/.bash_profile is run every time you login.
The first line loads keychain and points to the private key to cache. You
will be prompt for the passphase if this is the first time you login or if
for some reason the PID was stopped (the server lost power).
The second line sets the environment variables needed by ssh-agent to prefrom
logout, login, enter passphrase
source ~/.bash_profile, enter passphrase