How to solve the problem of "offending key in ~ /. Ssh/known_hosts "File

Source: Internet
Author: User
Document directory
  • Remove the offending SSH key
Remove the offending SSH key

Following error will be displayed when the remote host key changes (after you 've connected earlier with a valid remote host key ).

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@    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 isa7:a8:f2:97:94:33:58:b7:9d:bc:e0:a6:6b:f7:0a:29.Please contact your system administrator.Add correct host key in /home/ramesh/.ssh/known_hosts to get rid of this message.Offending key in /home/ramesh/.ssh/known_hosts: 6Permission denied (publickey,password).

You have to remove the key to proceed further. Use the following command to remove the offending key.

# sed -i '6d' ~/.ssh/known_hosts

Note: Change6dAccording to the line number shown.

If your sed does not have-I option, use Perl or use some editor to remove the offending key.

Perl solution:

# perl -pi -e 's/\Q$_// if ($. == 6);' ~/.ssh/known_hosts

Note: Change the line number from 6 to appropriate line number.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.