- Generate the key with
$ ssh-keygen -t rsa -b 4096 -v
and when asked to enter file in which to save the key, typemy-certificate
and when asked to enter passphrase, press Enter (empty passphrase) and confirm by Enter. - You will get two files generated, one will be my-certificate and one will be my-certificate.pub, make
my-certificate
on your computer read-onlysudo chmod 400 my-certificate
- Upload the public certificate to to server:
ssh-copy-id -i my-certificate.pub user@hostname
- By default appends user key in ~/.ssh/authorized_keys of the remote machine
- In case of requiring to force password authentication:
-o PreferredAuthentications=password
- OPTIONAL To copy your key to your clipboard:
xclip -selection clipboard < my-certificate.pub
- Launch ssh-agent:
eval $(ssh-agent)