Follow this link to skip to the main content

SSH Agent

How to setup ssh agent

Overview of commands:

  • ssh-keygen -C <comment>: creates a key, private in ~/.ssh/identity, public in ~/.ssh/identity.pub. Need to put public key in ~/.ssh/authorized_keys on server machine in order to work. You have to restrict access for it to work:
    chmod 600 ~/.ssh/authorized_keys
  • ssh-agent <command>: children of command will use agent, for example "ssh-agent xterm"
  • ssh-add: runs in child of ssh-agent, will prompt for passphrase.
  • ssh-add -l: lists currently authenticated keys

Actual commands to type to test on a single system (if it works for user on a given machine to ssh as themselves to that same machine it should work overall):

ssh-keygen

Hit enter to use default ~/.ssh/identity file. Type an RSA passphrase; this should be 10-30 characters long and essentially becomes your password for using ssh-ageint, and should be different than your yp or afs password

cd ~/.ssh
cat identity.pub > authorized_keys
chmod 600 ~/.ssh/authorized_keys
ssh-agent tcsh
This spawns a new shell, future commands are in the new shell

ssh-add

Type your RSA passphrase, same as you gave to ssh-keygen

ssh localhost

If this works, then the server ssh-agent is working properly, otherwise you can keep trying from this shell without having to retype your passphrase. If you're not certain if you're