I want to add an entry to my
/etc/ssh/ssh_known_hosts file without running
ssh-keyscan. I tried adding the public key but ssh complains, that the fingerprint does not match.
From the sshd man page:
SSH_KNOWN_HOSTS FILE FORMAT
The /etc/ssh/ssh_known_hosts and ~/.ssh/known_hosts files contain host public keys for all known hosts. The global file should be prepared by the administrator (optional), and the per-user file is maintained auto- matically: whenever the user connects to an unknown host, its key is added to the per-user file.
So my take from that would be, that one can add the public key data. However, it doesn’t seem to work for me.
ssh_known_hosts looks like this: (the key part matching the content of my public key file)
192.168.1.208 ssh-rsa AAAAB3Nza......zktpC1w==
running ssh-keyscan gives:
192.168.1.208 ecdsa-sha2-nistp256 AAAAE2V...2L0= 192.168.1.208 ssh-rsa AAAAB3Nza...38Ll 192.168.1.208 ssh-ed25519 AAAAC3Nza...m2Sc
So I can see, that the key shown for ssh-rsa ends differently from the content in my public key file.
How can I add the correct data to
ssh_known_hosts file without
(My environment: I use puttygen to create the keys, ssh-keygen etc. in a cygwin environment to convert as needed. Eventually the keys are used in Alpine linux VMs to ssh / scp between the VMs.)