Every time I install a new server I go through the process of setting up SSH keys for easy access. I wrote this documentation a few years ago so that I didn’t have to look it up on the web every time I need it. Now I figured I would post it on the web for others to access.

Generate private/public keys on A:

$ ssh-keygen -t dsa

Press enter when it asks for the filename.

Press enter when it asks for the passphrase (yes, a blank passphrase) this will generate two files: ~/.ssh/id_dsa and ~/.ssh/id_dsa.pub.

Put ~/.ssh/id_dsa.pub from A into ~/.ssh/authorized_keys2 on B:

$ cat ~/.ssh/id_dsa.pub | ssh B ‘cat >> ~/.ssh/authorized_keys2’

Make sure all files are not writable or readable except by owner on both A and B: