VSCode插件Remote-SSH连接远程服务器错误

The authenticity of hostx.x.x.x' can't be established.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? fail

该问题是因为vmare中的虚拟机设置的是nat模式,虚拟机IP发生变化导致秘钥不可用
解决方案:

  1. 删除服务器中的authorized_keys和knowns_host文件。
  2. 删除本地电脑中的秘钥文件重新生成(ssh-genkey),ssh-copy-id copy本地公钥到远程服务器
ssh-copy-id  -i ~/.ssh/id_rsa.pub [email protected]

  1. 通过ssh-keyscan查询本地公钥是否传输到远程服务器中\
  2. 重启vscode尝试远程

你可能感兴趣的:(vscode,ssh,服务器)