全部產品
Search
文件中心

:使用SSH遠端連線Linux系統的ECS執行個體時,提示“Host key verification failed”錯誤怎麼辦?

更新時間:Jun 03, 2026

本文介紹使用SSH遠端連線Linux系統的ECS執行個體時,提示“Host key verification failed”的錯誤原因和解決方案。

問題現象

  • 本地用戶端為Linux環境或macOS環境,使用SSH方式無法正常串連Linux系統的ECS執行個體時,提示如下錯誤資訊。

    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    @ 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
    ae:6e:68:4c:97:a6:91:81:11:38:8d:64:ff:92:13:50.
    Please contact your system administrator.
    Add correct host key in /root/.ssh/known_hosts to get rid of this message.
    Offending key in /root/.ssh/known_hosts:70
    RSA host key for x.x.x.x has changed and you have requested strict checking.
    Host key verification failed.
  • 本地用戶端為Windows環境,使用常見的SSH用戶端(如Putty或MobaXterm)串連Linux系統的ECS執行個體時,提示類似“The host key does not match the one Putty has cached for this server”或“remote server identification has changed”錯誤資訊。

    PuTTY 彈出 WARNING - POTENTIAL SECURITY BREACH! 安全警告對話方塊,密鑰類型為 ssh-ed25519,使用者可單擊 AcceptConnect OnceCancel 按鈕進行響應。

    MobaXterm的警告對話方塊提供三個操作按鈕:Accept the new server hostkey and carry on connectingRefuse the new server hostkey and abort the connectionAccept and save as additional hostkey (keep the existing ones)

問題原因

該ECS執行個體可能進行過重裝系統、賬戶資訊變更等操作,導致ECS執行個體SSH公開金鑰變更,造成本地用戶端儲存的公開金鑰指紋與伺服器端不一致,出現該提示資訊。

解決方案

您可以根據本地用戶端環境不同,選擇合適的方案。

本地用戶端為Windows環境

本文以SSH用戶端Putty和MobaXterm進行介紹,不同SSH用戶端操作有所差異,請根據實際的用戶端進行操作。

用戶端為Putty時,單擊Accept,Putty會自動更新密鑰指紋資訊,即可成功登入執行個體。

用戶端為MobaXterm時,單擊Accept the new server hostkey and carry on connecting,MobaXterm會自動更新密鑰指紋資訊,即可成功登入執行個體。

本地用戶端為Linux或macOS環境

  1. 在本地用戶端中,執行如下命令,進入對應帳號的known_hosts檔案。

    vim ~/.ssh/known_hosts
  2. i鍵進入編輯模式。

  3. 刪除ECS執行個體IP對應的條目,如以下樣本所示。

    39.105.    ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBEPMCfKNtd5Pkjp4A+ocwNzeTN
    fLNrUf3a0EfqXj4X4URJMPEzEl94ftuA7ZltOM0cAMkeZzOql
    ~
  4. Esc鍵,輸入:wq儲存並退出。

  5. 重新串連Linux執行個體,確保可以正常串連。