Gary Kuhlmann - March 28, 2017
First you have to create the public and private key pair files.
Open the Terminal application
Execute the following command
ssh-keygen -t rsa
Go through the questions and answer. Most of the time the defaults are fine.
This will generate two files in your user’s ~/.ssh/ directory (if you followed the defaults). The first one, or private key, will not have an extension. The second, or public key, with have a .pub extension. You will need to keep the private key safe from prying eyes but the public file (id_rsa.pub) can now be added to any user account’s authorized_keys file by doing the following from the user’s home directory:
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
This will add the public file contents to the authorized_keys file (and create an authorized_keys file if it does not exist). Next, you need to make sure the permissions are set correctly by executing:
chmod 600 ~/.ssh/authorized_keys
Now you should be able to log into this system from any system that has the private part of key. Just be aware that your client machine might have permission requirements of its own for this private key file.
Source: https://www.centos.org/docs/5/html/5.1/Deployment_Guide/s3-openssh-rsa-keys-v2.html