These are the steps:
Suppose you want to connect from machine X to machine Y as userme.
* login to X as userme
* At /home/userme run this command:
ssh-keygen -t rsa
This will generate 2 files in /home/userme/.ssh folder
* open file and copy its contents – this is the public key
* Now login to machine Y as userme, open file /opt/userme/.ssh/authorized_keys – If path/file does not exist create it
* Append contents copied from on machine X to the end of authorized_keys file
* Save file and exit
Now you can ssh to machine Y from X without entering credentials.