添加主机到known_hosts

https://baijiahao.baidu.com/s?id=1762795564128954284&wfr=spider&for=pc

#rsa证书
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
#ed25519证书
ssh-keyscan -t ed25519 192.168.110.52 >> ~/.ssh/known_hosts
ssh-keyscan -t ed25519 -f ~/.ssh/id_ed25519_x205 192.168.110.52 >> ~/.ssh/known_hosts

#查看主机 SSH 公钥,并输出调试信息
ssh-keyscan -v 127.0.0.1
ssh-keyscan -v 192.168.110.52

刷新known_hosts中对应远程服务器公钥,推荐此方法

ssh-keygen -R server_ip_address
ssh-keyscan -H server_ip_address >> ~/.ssh/known_hosts

直接删除known_hosts文件

rm -f ~/.ssh/known_hosts

只删除对应的ip的公钥文件

编辑 ~/.ssh/known_hosts 文件,将目标ip公钥信息删除后保存即可