ssh-keyscan host
https://superuser.com/questions/971766/adding-a-public-key-to-known-hosts-file
Manual page for sshd(8) describes the format of known_hosts file:
Each line in these files contains the following fields: markers (optional), hostnames, bits, exponent, modulus, comment. The fields are separated by spaces.
If your public key for your host looks like this:
ssh-rsa AAAA1234.....=
So just putting this line into your ~/.ssh/known_hosts file:
your.host.name,0.0.0.0 ssh-rsa AAAA1234.....=
where you will exchange hostname and ip for your host.
Now it depends if you have ssh option HashKnownHosts turned on. If not, you are done. Otherwise you will need to hash this file usingssh-keygen -H ~/.ssh/known_hosts.
本文介绍如何将公钥添加到 SSH 的 known_hosts 文件中,并解释了该文件的格式及内容。文中还介绍了如何手动编辑该文件以及当启用 HashKnownHosts 选项时如何使用 ssh-keygen 对文件进行哈希。
1250

被折叠的 条评论
为什么被折叠?



