Mac和Linux远程连接服务器异常修复(WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!)

一、今天在使用SSH,连接远程服务器的时候,刚开始是没问题的。 
后来阿里云主机重装了一下系统后,再也连不上了。一直报一个错。

~ ⌚ 22:49:52
$ ssh root@47.98.233.15
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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.
1
三、以编辑器的方式进入这个文件

 vi /Users/wangdong/.ssh/known_hosts
1
四、将红线框部分删除掉 


五、再次进行远程连接

~ ⌚ 22:52:18
$ ssh root@47.98.233.15              
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.
root@47.98.233.15'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文件中,所以如果远程重装系统了,本机一定要先清理掉。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值