Generating your SSH Key on Mac

  • Home
  • Docs
  • Generating your SSH Key on Mac

Generating your SSH Key on Mac

Macs have ssh built right in! Here's how to set it up:

First, generate a new ssh key, or use Userify's private key generator:

mkdir ~/.ssh/
ssh-keygen -C "[email protected]"

When the command asks you where to save your key, just hit enter.

When prompted, a long, strong passphrase is recommended (use a phrase that only you know; it's not necessary to mix in extra punctuation if the passphrase is at least 5 or 6 randomly-chosen words.) Press enter for any other prompts.

You'll only have to type your passphrase in when you log into your desktop session, not every time you want to log into a server. Since you're using Userify, if you forget your passphrase in the future, it's easy to rm .ssh/id_rsa* and then re-deploy a fresh key.

This will generate your SSH private key in the file ~/.ssh/id_rsa and your public key in the file ~/.ssh/ (Note the *.pub*). (~ is shorthand for your home directory, i.e., /home/username)

Upload your public key to Userify by copying and pasting the contents of ~/.ssh/ in your home directory to Userify. Just cat the file and copy it from your terminal and paste it into Userify:

cat ~/.ssh/

If you have set a passphrase for your key (suggested for greater security), Mac already has a built-in key manager that will work automatically, so you only have to unlock your key when you log into your Mac.

From now on, you can connect to any Userify-enabled server without typing a password, just by typing in:

ssh [email protected]