How do I tidy up old ssh keys?
If you have forgotten your passphrase you will need to regenerate your ssh keys. Before doing so, you will need to tidy up the old keys otherwise the ssh agent can get itself confused.
Go to your ~/.ssh directory, and look at the files, you should see something like:
puma$ ls ~/.ssh environment.puma id_rsa id_rsa.pub known_hosts ssh-setup
Delete the public and private keys. These will normally be named id_rsa and id_rsa.pub, or id_dsa and id_dsa.pub.
You should also delete the environment.puma file.
Next check if you have an agent running:
puma$ ps -flu <puma-username> | grep ssh-agent
If an agent is running, one or more lines like the following will be returned:
15658 ? 00:00:00 ssh-agent
The number in the first column is the process-id, pass this to the kill command to stop the process, for example:
puma$ kill -9 15658