How do I remove a permanently added host from the list of known hosts?

I am currently working on a project organized by my university. We use git as a source control and when I connect to a host for the first time, the following message is displayed: "Warning: Permanently added" ... "(RSA) to the list of known hosts."

  • What does it mean?

  • After completing the task, how can I remove this from the list of known hosts? Are there any problems if I don't?

+3


source to share


2 answers


If something was added to the "list of known hosts" and then in git bash under Windows as well as under Linux, the entry will be added to the known_hosts file , which can be found in the .ssh directory under the home directory.

It is a text file and displays entries for any hostname / ip / key combinations already added.

So, cat ~/.ssh/known_hosts

should show next file

You can see something similar to the following



removeelater.com, 123.456.789.10 key view key type TheKeyForRemoveLaterHost keep.com, 321.654.987.10 ssh-rsa differentSetOfCharactersRepresentingKeyForKeepHost ==

There are two lines in the above file.

Using your favorite editor (like vi ~/.ssh/known_hosts

or notepad ~/.ssh/known_hosts

), simply delete the entire line containing the link to the host you want to delete and save the file.

Attempting to reconnect to the host you have now deleted will result in

Unable to authenticate host 'removeelater.com (123.456.789.10).

+4


source


This means that git was using SSH to log into the remote host for you and that you have never connected to this server before, and therefore it added the server to the list of known hosts. If the server ever changes its identity (for example, your connection is intercepted by an attacker), SSH will refuse to connect to it.

Read the following: https://security.stackexchange.com/questions/20706/what-is-the-difference-between-authorized-key-and-known-host-file-for-ssh



You don't need to worry about this unless you're paranoid and expecting someone to try to steal your password or your work.

+1


source







All Articles