Not sure at what OS X version this has been possible from. Here we will see how to set up the mac for password less ssh connection with RSA certificate. This will make your daily terminal life at bit easier, and also more secure as you can disable password logins on your root user (if you allow remote root connections).
First we need to create two RSA certificates. One public key, and one private key. The public key contains the information you put on the remote server. And the private key is the one you use to authenticate to the remote server.
Open Terminal, or go to your home folder if it´s already open.
Create a folder to save the certificates.
mkdir .ssh
If you have used SSH before from that mac, the folder already exist.
So just change directory to .ssh
cd .ssh
Then we will create the keys.
ssh-keygen -b 2048 -t rsa -f id_rsa -P “”
-b 2048 means we will use 2048 bit encryption
-t rss means we will create rsa key pair
-f id_rsa is the filename we will like to use
-P “” means we have no password in the RSA certificate
I haven´t found a mac version of the linux tool ssh-copy-id, so we will have to do this manually. Chances are you key file on your remote system is empty, since you´re reading this article.
You are still in the .ssh directory on your mac. If you got the .ssh directory on your remote system already, just delete the mkdir .ssh; from the line below.
cat id_rsa.pub | ssh john@192.168.1.80 “mkdir .ssh; cat >> .ssh/authorized_keys”
This one liner is basically the same as the ssh-copy-id command in linux.
Now you can try to login to your remote system, and it should´t ask for any passwords. If it does, I would check the authorised_keys file in the remote system. Should be in a folder called .ssh in your home directory.
Happy sshing!