- Generate the key with
$ ssh-keygen -t rsa -b 4096 -vand when asked to enter file in which to save the key, typemy-certificateand 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-certificateon 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)