Deleting an RSA host key

When logging into another computer using SSH, an RSA host key is stored on the terminal computer and then checked for parity at future logins.

If the operating system of the host computer changes (e.g. re-install with the same hostname), an error message will occur notifying the user that the remote host ID has changed and access will be denied:

Deleting an RSA host key

If you are sure that the changes made to the host computer were legitimate, you can edit the known_hosts file and delete the original key. At the next login you will be prompted to verify the host machine again. This will add the correct key to the known_hosts file and allow access.

To delete the key use either of the following:

Using the GUI:

  1. Browse to the home directory of the user that requires login access.
  2. Browse to the ./ssh directory, and open the file named known_hosts.
    Tip: Show hidden directories, if required.
  3. Find the offending key, delete, save and exit.
    Tip: If you are unsure of the correct key, simply delete them all and save the empty file. You will then be prompted again to verify any machine that had previously been given access.

Via the terminal:

  1. Open a terminal session and type:
    vi /home/user/.ssh/known_hosts
    or
    gedit /home/user/.ssh/known_hosts

    Note: Edit the above path by amending user with the user that requires login access.

    Add su or sudo to the above commands for root privileges to edit.

  2. Find the offending key, delete, save and exit.
    Tip: If you are unsure of the correct key, simply delete them all and save the empty file. You will then be prompted again to verify any machine that had previously been given access.

Go back to the How-to Guides main page.

Search

Starter website

Offering small businesses and individual users the opportunity to have their own website on the internet, our 'starter websites' are available for only £150.

new site offer

To find out more and to see an example of the type of site offered, view our example starter website page.