user@host:~$ ssh user@server @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: POSSIBLE DNS SPOOFING DETECTED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ The RSA host key for server has changed, and the key for the corresponding IP address 1.2.3.4 is unknown. This could either mean that DNS SPOOFING is happening or the IP address for the host and its host key have changed at the same time. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that the RSA host key has just been changed. The fingerprint for the RSA key sent by the remote host is ff:ff:f:ff:ff:ff:ff:ff:ff:f:ff:ff:ff:ff Please contact your system administrator. Add correct host key in /home/user/.ssh/known_hosts to get rid of this message. Offending key in /home/user/.ssh/known_hosts:49 RSA host key for server has changed and you have requested strict checking. Host key verification failed. user@host:~$ sed -i '49d' ~/.ssh/known_hosts user@host:~$ ssh user@server The authenticity of host 'server (1.2.3.4)' can't be established. RSA key fingerprint is ff:ff:f:ff:ff:ff:ff:ff:ff:f:ff:ff:ff:ff. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'server,1.2.3.4' (RSA) to the list of known hosts. user@server's password:
remove the host for the .ssh/know_host file
For example, to remove line 5 from foo, type: vi +5d +wq foo
Easily removes line #2 in ~/.ssh/known_hosts. Show Sample Output
Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?
You must be signed in to comment.
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for:
ssh-keygen -R www.example.com
mv ~/.ssh/known_hosts ~/.ssh/known_hosts.old; sed "${LINE}d" ~/.ssh/known_hosts.old > ~/.ssh/known_hosts
... because not only does ssh-keygen silently fail with the -R option on my (ooooold) system, but sed doesn't know -i either ...