How to access a server with an SSH key

1. Generate a key on the client

ssh-keygen -t ed25519 -C "client name" Keep the default file name when prompted. Choose a passphrase and finish. Now the key is stored in ~/.ssh/id_ed25519.pub

2. Copy the public key to the server

ssh-copy-id -i ~/.ssh/id_ed25519.pub user@x.x.x.x This will add the public key to the server, stored in ~/.ssh/authorized_keys

3. Simplify the connection

It is possible to add host information in one config file: ~/.ssh/config Add for every host: Host servername Hostname x.x.x.x User user IdentityFile ~/.ssh7id_ed25519 IdentitiesOnly yes

4. Now it is possible to connect with:

ssh servername A passphrase will be required if set.