windows vs code配置ssh 远程免密连接服务器

之前按照vs code的文档配置过一次
后来远程服务器重装系统了
再放上public key就连不上了
虽然不是什么复杂的事情但是因为太菜鸡了嘛花了挺多时间的

> 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:************************.
> Please contact your system administrator.
> Add correct host key in C:\\Users\\THINKPAD/.ssh/known_hosts to get rid of this
> message.
> Offending ECDSA key in C:\\Users\\THINKPAD/.ssh/known_hosts:7
> ECDSA host key for ***.***.***.*** has changed and you have requested strict checki
> ng.
> Host key verification failed.
原因就是ssh会把访问过的主机的公钥都记录在这里,下次访问的时候核对公钥但是重装了系统以后的openssh公钥也就不一样了嘛这就导致了访问出错
不过觉得这种机制很狗的地方在于Linux有好几个用户然后公钥不一样是会有冲突的(虽然我没有试过只用了一个用户
这件事情告诉我们要认真看报错信息,然后实名diss csdn/掘金/简书/知乎 互相之间抄来抄去的人
以上

Leave a Reply

Your email address will not be published. Required fields are marked *