Simple RSA Passwordless SSH Into Unix Server via OSX

Passwordless SSH is something I use daily, but it was one of those tasks I never invested time into understanding. A one-off task: follow tutorials and forget. However, it seems every few years something changes and I have to redo my RSA keys on my Mac andor my servers.

This year, after an upgrade to Mac OS X Sierra, marks the fourth time I’ve had to temporarily learn how to set RSA Keys up again, and I’ve decided to actually invest in it this time in learning so the firth time, I can do it without reference and tons of reading.

There are many better written articles on how to do this, however, I personally found the majority of them difficult to understand or follow – so I’ve tried to make this as simple as possible.

For this tutorials “Remote” is Bash via Ubuntu 16 on EC2 AWS service, and “Local” is  Terminal on OS X Sierra.


  1. Create a key pair, where keyname is your servers name

  1. Copy the contents of newly created file ~/.ssh/keyname for next step


  1. Create and paste contents from the above into this new .pem file (close and save file). Then add the .pem to OSX

That’s it. Really.

You can now login passwordless:

I have three optional extra’s that I personally do that make it a litter better. First, name your keypair appropriately, most tutorials all have idrsa or idusername and if you’ve got or will get multiple servers, your local ~/.ssh folder will be a pile of unknown randomness.

I also suggest setting AWS security to allow SSH only on a random port, like 42111 or something like that, prevent unwanted SSH attempts by limiting where your door is.

Lastly, adding an alias to your local bash for the SSH connection command with a single word is a great second saver. Heres how to do it via Terminal on your Local: