macos无法通过ssh连接Linux云服务器

问题产生

因为本人将自己的阿里云服务器格式化了,因此macos 通过ssh连接时提示:

leafii@LeafiideMacBook-Pro  ~sudo sshroot@
Password:????????
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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
ea:24:31:8d:03:07:36:db:2f:74:15:5d:58:67:a3:5b.
Please contact your system administrator.
Add correct host key in /var/root/.ssh/known_hosts to get rid of this message.
Offending key in /var/root/.ssh/known_hosts:1
RSA host key for 192.168.1.203 has changed and you have requested strict checking.
Host key verification failed.

原因:

Mac保存了秘钥信息,你初始化服务器之后,秘钥就变了,所以不能登录,利用上面的程序清除旧的秘钥信息即可正常登录了!

解决办法

在终端执行命令:

ssh-keygen -R IP(你远程服务器ip地址)