Resolve the problem that MAC fails to use SSH command to connect to remote Linux

Problem Description:

SSH connection:

$SSH [email protected]# output:
@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @@    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 a host key has just been changed. The fingerprint for the ECDSA key sent by the remote host is SHA256:5yU0DRFAiHsPCb2v8j5YpqmMbeVQsqr1yFo4xXLIu84. Please contact your system administrator. Add correct host key in /Users/dongxueyong/.ssh/known_hosts to get rid of this message. Offending ECDSA key in /Users/dongxueyong/.ssh/known_hosts:3 ECDSA host key for 192.168.0.108 has changed and you have requested strict checking. Host key verification failed. Copy the code

Baidu translate:

@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @Warning: Remote host id has changed! @@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @Someone could be doing something bad!Someone could be eavesdropping on you right now (man-in-the-middle attack)!It could be that the host key has just been changed.The fingerprint of the ECDSA key sent by the remote host isSHA256:5 yu0drfaihspcb2v8j5ypqmmbevqr1yfo4xxliu84.Please contact your system administrator.In/Users/dongxueyong /. SSH/known \ u hosts add the correct host key to delete this message./ Users/dongxueyong /. SSH/known there is a problem with the ECDSA key _ host: threeThe ECDSA host key for 192.168.0.108 has changed. You have requested a strict check.The host key authentication failed. ProcedureCopy the code

After the translation, do you still not understand?

The truth is, the current MAC must do two things:

  • Connected to the same LAN IP address on different Lans
  • The computer has been cleaned (cleared of information related to my local SSH connection protocol)

As a result, the public key information of the host has been modified. Therefore, the host cannot be connected

The solution

Execute this command:

ssh-keygen -R "IP address of your remote server" 
Copy the code
$ ssh-keygen -R "192.168.0.108"
# output:
# Host 192.168.0.108 found: line 3
/Users/dongxueyong/.ssh/known_hosts updated.
Original contents retained as /Users/dongxueyong/.ssh/known_hosts.old
# reconnect $SSH [email protected]The authenticity of host '192.168.0.108 (192.168.0.108)' can't be established. ECDSA key fingerprint is SHA256:5yU0DRFAiHsPCb2v8j5YpqmMbeVQsqr1yFo4xXLIu84. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '192.168.0.108' (ECDSA) to the list of known hosts. [email protected] 's password: Last login: Wed Sep 23 23:50:09 2020 [root@localhost ~]#  -------------- Ok! And you're done!Copy the code

I have also registered and opened my personal wechat public account “Jeesoul”. Please post a QR code and follow me.Jeesoul is dedicated to sharing all kinds of language technologies. No learning will not, only unwilling to learn. Welcome to exchange and study together! I will also introduce:

  • Docker Series Combat
  • “SpringCloudAlibaba Series Combat”
  • Mysql Learning Tips
  • “Java Concurrent Programming + Practice”
  • Python3 web crawler
  • Basic Operation and Maintenance combat and so on…