Reputation:
Currently I'm working on a project hosted by my university. We are using git as version control tool and when I connect to host 1st time it displays the following message: "Warning: Permanently added '...' (RSA) to the list of known hosts."
What does this exactly means?
After the job is done, how can I remove this from the known hosts list? Is there any problem if I don't?
Upvotes: 23
Views: 58655
Reputation: 487
The simplest way to remove just one host from known_hosts is to use:
ssh-keygen -R hostname
Example
ssh-keygen -R 192.168.1.10
ssh-keygen -R abc.lan
ssh-keygen -R domain.com
Upvotes: 19
Reputation: 1352
Following is a quick rewrite I use on Mac for removing a specific host from known_host file:
grep -v <full.hostname> ~/.ssh/known_hosts > temp.txt
mv temp.txt ~/.ssh/known_hosts
This basically rewrites everything from the known_hosts files except line(s) that contain(s) the specified hostname.
Upvotes: 0
Reputation: 544
If something has been added to 'list of known hosts' then in git bash shell under Windows and also under linux, an entry will have been added to the file known_hosts which can be found in .ssh directory below your home directory.
This is a text file and will show entries for any hostname/ip address/key combinations that have already been added.
So
cat ~/.ssh/known_hosts
should show the following file
You may see something similar to the following
removelater.com,123.456.789.10 type-of-key charactersRepresentingTheKeyForRemoveLaterHost keep.com,321.654.987.10 ssh-rsa differentSetOfCharactersRepresentingKeyForKeepHost==
The above file has two lines.
Using your favorite editor (e.g. vi ~/.ssh/known_hosts
or notepad ~/.ssh/known_hosts
), simply delete the complete line which has the reference to the host you want to remove and save the file.
Trying to connect again to the host that you have now removed will once more result in
The authenticity of host 'removelater.com (123.456.789.10)' can't be established.
Upvotes: 23
Reputation: 6847
It means that git has used SSH to sign into the remote host for you, and that you had never connected to that server before, and so it added the server to your list of known hosts. If the server ever changes its identity (e.g. your connection is being intercepted by an attacker) then SSH will refuse to connect to it.
There's no need to worry about this though, unless you are paranoid and expecting someone to try to steal your password or your work.
Upvotes: 1