There are some commands that I only need every sixth new moon or so. Since I ‘m not getting any younger, I regularly have to Google them.
So, here is a quick post on how to make SSH logins authenticate via a key pair instead of a password.
On the host, create the private and public key:
ssh-keygen
Just press Enter to accept the default values.
I usually only need this for uncritical test and development setups where security is not a primary concern.
There will be two files in ~/.ssh.
The private key is id_rsa and the public key is id_rsa.pub.
Now copy the public key to the server with:
ssh-copy-id <username>@<host>
Check that you can log into the server without providing a password:
ssh <username>@<host>
Yes, it really is that simple.