Host keys ssh_host_rsa_key.pub
are stored automatically by ssh
in known_hosts
files; they are not intended to be managed by the user.
The authorized_keys
is intended for user identity files. What you really want to do is to use ssh-keygen to generate an identity file representing you:
ssh-keygen -t ecdsa
Two identity files are generated: the private key id_ecdsa
and the public key id_ecdsa.pub
. Copy the public key into server2's .ssh/authorized_keys
.
If you created a passphrase for your identity files, that's what you will be using from now on. Otherwise, your login will be password-less.