一、今天在使用SSH,連接配接遠端伺服器的時候,剛開始是沒問題的。
後來阿裡雲主機重裝了一下系統後,再也連不上了。一直報一個錯。
~ ⌚ 22:49:52
$ ssh [email protected]
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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:8hgJ8jpcBr1tm6HS72FpXwMrjba8MQqlqYJQLPB/Qf4.
Please contact your system administrator.
Add correct host key in /Users/wangdong/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/wangdong/.ssh/known_hosts:26
ECDSA host key for 47.98.233.15 has changed and you have requested strict checking.
Host key verification failed.
二、解決方法,看錯誤日志中有一句
Add correct host key in /Users/wangdong/.ssh/known_hosts to get rid of this message.
三、以編輯器的方式進入這個檔案
vi /Users/wangdong/.ssh/known_hosts
四、将紅線框部分删除掉
五、再次進行遠端連接配接
~ ⌚ 22:52:18
$ ssh [email protected]
The authenticity of host '47.98.233.15 (47.98.233.15)' can't be established.
ECDSA key fingerprint is SHA256:8hgJ8jpcBr1tm6HS72FpXwMrjba8MQqlqYJQLPB/Qf4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '47.98.233.15' (ECDSA) to the list of known hosts.
[email protected]'s password:
Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-105-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
Welcome to Alibaba Cloud Elastic Compute Service !
root@iZbp17cj14ulhfrlj02rkaZ:~#
問題就解決了,原因是因為才重裝系統後,再次進行遠端連接配接上,在輸入yes後,本機會将遠端機器的資訊,寫到/Users/wangdong/.ssh/known_hosts檔案中,是以如果遠端重裝系統了,本機一定要先清理掉。