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  known_hosts  ssh-setup

Delete the public and private keys. These will normally be named id_rsa and, or id_dsa and

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
Last modified 21 months ago Last modified on 04/12/15 13:27:39