SSH key

A key pair used to log in over SSH: the private key stays on your machine and the public key is added to the server account.

Whoever holds the private key can log in to every host that trusts it.

In more detail

The public half is placed on the server in the account's authorized_keys file, and the private half stays with you and proves who you are. The private key must never be committed or shared, and can itself be protected with a passphrase.

Examples

ansible_ssh_private_key_file=keys/deploy_ed25519 tells Ansible which private key to use for a host or group.
ssh-keygen -t ed25519 creates one. The client proves it holds the private key without sending it, and the server admits the user only if the public key is listed in that account's authorized_keys. Protect the private key with a passphrase.
alias=prod host=server user=ana p=22 key=id_ed names the identity file a host alias uses.
A copied private key logs in anywhere its public key is trusted, with no password.

Related terms

Taught in

References

Certification courses