First, make sure you can SSH to your server. If you need to install ssh on the Ubuntu server, use:
sudo apt-get install ssh mkdir ~/.ssh touch ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys chmod 700 ~/.ssh
If you are wondering what the touch does, it just creates an empty file if it doesn’t exist. That way i don’t have to write two sets of instructions based on whether you’ve ever had SSH configured before. Next we are going to generate our keys and upload them to the server
ssh-keygen -t rsa scp email@example.com:~/.ssh/authorized_keys ~/.ssh cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys scp ~/.ssh/authorized_keys firstname.lastname@example.org:.ssh/
What we are doing is copying the existing authorized_keys file to our local mac to add our key and then uploading it back. We should now be able to login to our server using our new keys.
The Mac will now prompt you for the password you used to create your ssh key. Add it to your keychain. From this point forward, you will no longer be prompted with your password. Yay!