In client PC

Generate ssh key if you don’t have one

1
$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

Then copy (to clipboard) the public key (with the extension .pub), e.g.

1
$ pbcopy < ~/.ssh/id_rsa.pub

In server

Add the public key to ~/.ssh/authorized_keys

1
$ vim ~/.ssh/authorized_keys

Then paste the public key to next line of this file, save it

Test it

1
$ ssh -i ~/.ssh/id_rsa user@xxx.xxx.xxx.xxx

You should be able to login without prompt you to input password

References: