An SSH key pair lets you authenticate using a private key on your device and a public key on the server. Generate it on the device you will use to connect, then authorise only the public key on the destination.
Generate a key pair
In a terminal with OpenSSH installed, run:
ssh-keygen -t ed25519 -C "hosting-access"- Choose a file location, or accept the proposed default if it does not contain a key you need to keep.
- Enter a strong passphrase to protect the private key.
- Confirm the passphrase and check the generated file locations.
Do not overwrite an existing key unintentionally. The passphrase protects this key; it is not the remote account’s password.
Identify the files
The public key has a .pub suffix, such as ~/.ssh/id_ed25519.pub. The corresponding file without that suffix is the private key and must stay private.
Authorise the public key through the destination’s SSH key interface or authorised-keys process, then test access. If the server’s policy does not support Ed25519, use its supported algorithm, such as RSA with an appropriate key size, rather than changing the policy blindly.