Allow Alice's public-key authentication on server.example.
Register the key for Alice's account on the destination host.
Which location is standard?
The destination user's allowed public keys are stored in ~/.ssh/authorized_keys. Never copy the private key there.
Detailed explanation
~alice/.ssh/authorized_keysCorrect. Alice's public key belongs in her remote ~/.ssh/authorized_keys.
~alice/.ssh/known_hostsIncorrect. known_hosts stores client-side host keys.
~alice/.ssh/id_rsaIncorrect. id_rsa is a private key and must remain on the client.
/etc/hostsIncorrect. /etc/hosts maps names to addresses and is unrelated to SSH key authentication.
Try it yourself
An example you can run in a temporary verification environment.
ssh -G server.example | grep '^userknownhostsfile'Expected result
クライアント側known_hosts設定。authorized_keysとは役割が異なるKey points
- Public key
- authorized_keys
- Remote account
Notes
- Environment: OpenSSH 9.x
- Use a disposable VM or test account when validating installation and SSH behavior.
- Exact command output can vary slightly by distribution and OpenSSH version.
Foundation review
Identify the scope
known_hosts and private-key files have client-side roles and must not be substituted for the server’s allow-list.
Check the side effect
Verify ownership and restrictive permissions on the account’s SSH directory and authorized_keys file.