I can never remember how to do this, so here’s the simple step-by-step for logging-in from client$ to server$
Create your key
client$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user/.ssh/id_rsa.
Your public key has been saved in /home/user/.ssh/id_rsa.pub.
The key fingerprint is:
b2:ad:a0:80:85:ad:6c:16:bd:1c:e7:63:4f:a0:00:15 user@host
The key's randomart image is:
+---[RSA 2048]----+
| . o + |
| = X * . |
| . O @ = . .|
| + o X O . + |
| . = S * = o |
| . ..o . . o . |
| + .o. E |
| + ...o. |
| . . ooo+. |
+----[SHA256]-----+
Copy the key to the server
client$ ssh-copy-id user@server
user@server's password:
Profit!
client$ ssh user@server
Last login: Tue Apr 22 11:35:41 2019 from 10.23.45.67
server$
Credit: https://www.linuxtrainingacademy.com/ssh-login-without-password/