- On the server, e.g. server, create a
.ssh
folder:
mkdir -p ~/.ssh
- On your client, generate a SSH key pair (ie public key,
id_rsa.pub
, and private key,id_rsa
):
ssh-keygen -t rsa
Just hit "ENTER" for the passphrase. This selects the default behavior.
- From your client, copy the public key,
id_rsa.pub
, to the server:
cat ~/.ssh/id_rsa.pub | ssh server 'cat >> ~/.ssh/authorized_keys'
Note: keep your private key, ~/.ssh/id_rsa
, PRIVATE !