There are two types of keys: RSA and DSA. Both can be used with SSH protocol version 2. Normally you don't need both and RSA is recommended.
To generate a RSA ssh key pair type:-
ssh-keygen -t rsa
The transcript looks something like:-
Generating public/private rsa key pair. Enter file in which to save the key (/home/sudbury/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in .../.ssh/id_rsa. Your public key has been saved in .../.ssh/id_rsa.pub. The key fingerprint is: d0:03:b9:7c:43:33:f3:6e:13:cc:08:c9:93:8a:16:a4 sudbury@pplxint1.physics.ox.ac.uk
It is best to pick a long but easy to remember pass phrase. For example some sentence. Do not use a blank pass phrase, nor your regular account password.
If, for some reason, you need to set up an DSA ssh key pair, type:-
ssh-keygen -t dsa
The results of running ssh-keygen is a private and a public key file placed in $HOME/.ssh/. The file names will be based on what type of key you specified. For RSA they are:-
id_rsa id_rsa.pub
For DSA they are:-
id_dsa id_dsa.pub
Caution: The RSA keys for SSH protocol 1 are:-
identity identity.pub
They will work with protocol 2 but are weaker and should not be used.