-
Generate an SSH key that uses the Ed25519 algorithm.
ssh-keygen -a 100 -t ed25519 -f ~/.ssh/id_ed25519
-
-a
Specifies the number of KDF (key derivation function) rounds used. Higher numbers result in slower passphrase verification and increased resistance to brute-force password cracking. -
-t
Specifies the type of key to create. -
-f
Specifies the filename of the key file.
Generated keys:
- Private
~/.ssh/id_ed25519
- Public
~/.ssh/id_ed25519.pub
A useful command to check all available SSH keys.
for key in ~/.ssh/id_*; do ssh-keygen -l -f "${key}"; done | uniq
-
-
Upload the public key to the remote host.
ssh-copy-id -i ~/.ssh/id_ed25519 [email protected]
i
Use only the key(s) contained in identity_file.
-
Test the public key has been uploaded to the remote host.
ssh -i ~/.ssh/id_ed25519 [email protected]
-
Update the SSH config on the local host.
vi ~/.ssh/config
Host remote-host HostName remote-host.dev User username IdentityFile ~/.ssh/id_ed25519 IdentitiesOnly yes
-
Test SSH configuration.
ssh remote-host