美文网首页
刘月林 | 清除当前机器关于远程服务器的缓存和公钥信息

刘月林 | 清除当前机器关于远程服务器的缓存和公钥信息

作者: 刘月林Yuelin_MELB | 来源:发表于2018-07-25 11:51 被阅读0次

    前些阵子对照 word 文档进行了阿里云部署的学习,结果以失败而告终。今天按照慕课网上 nodejs 线上产品部署和发布的教程来到了阿里云部署的环节。老师要求 Ubuntu 所安装的版本是 14.04, 而我之前安装的版本是 16.04,所以应该重装系统盘。步骤是来到实例列表,在操作栏的下方点击更多,先在实例状态里面选择停止,再到磁盘和镜像里面选择重装系统盘。

    aliyun.gif
    重装之后返回 cmd 重新输入ssh root@'ip地址'进行远程连接,这时碰到了一个问题:
     liuyuelin@liuyuelindeMacBook-Pro ⮀ ~ ⮀ ssh root@47.92.157.160
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    @    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:v9etjDGuFPjX8KTB7/tHI00wuOY2DPifS6579rttD0c.
    Please contact your system administrator.
    Add correct host key in /Users/liuyuelin/.ssh/known_hosts to get rid of this message.
    Offending ECDSA key in /Users/liuyuelin/.ssh/known_hosts:4
    ECDSA host key for 47.92.157.160 has changed and you have requested strict checking.
    Host key verification failed.
    

    查阅资料后,发现原因:远程的系统改变了,那么加密的密钥也改变了,所以本地已经保存的密钥就失效了,需要重新保存密钥,密钥保存的位置在/$HOME/.ssh/known_hosts

    解决方法:打开 know_hosts 文件,删除系统提示错误的这一行(此处是第四行)。或者是在命令行中输入ssh-keygen -R "你的远程服务器ip地址".然后重新输入ssh root@'ip地址',输入密码即刻完成登录:

    liuyuelin@liuyuelindeMacBook-Pro ⮀ ~ ⮀ ssh root@47.92.157.160
    The authenticity of host '47.92.157.160 (47.92.157.160)' can't be established.
    ECDSA key fingerprint is SHA256:v9etjDGuFPjX8KTB7/tHI00wuOY2DPifS6579rttD0c.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added '47.92.157.160' (ECDSA) to the list of known hosts.
    root@47.92.157.160's password:
    Permission denied, please try again.
    root@47.92.157.160's password:
    Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 4.4.0-93-generic x86_64)
    
     * Documentation:  https://help.ubuntu.com/
    
    Welcome to Alibaba Cloud Elastic Compute Service !
    
    root@iZ8vb998xn4i8tljwbdsokZ:~#
    



    刘月林
    写于湖北沙洋
    2018/07/25

    相关文章

      网友评论

          本文标题:刘月林 | 清除当前机器关于远程服务器的缓存和公钥信息

          本文链接:https://www.haomeiwen.com/subject/fghpmftx.html