Overview

You need an SSH key pair in order to authenticate against Beach services or for logging in into a Beach or Local Beach instance. Once you have a key, you won't want to enter the passphrase every time you use it. That's what the "SSH Agent" is for.

In this guide you'll learn how to generate an SSH key pair and how to add it to your SSH Agent.

Generating an SSH key pair

Open your terminal and run the following command, using your own email address:

$ ssh-keygen -t rsa -b 4096 -C "you@example.com"

Generating public/private rsa key pair.

When the key pair was created, you're asked to enter a filename where to save the key. Simply press Enter to accept the default location.

Finally, you'll be prompted for a passphrase. Make sure to choose a good passphrase and save it in a secure location (like a password manager).

Your private key will end up in a file like /Users/robert/.ssh/id_rsa and the corresponding public key in /Users/robert/.ssh/id_rsa.pub.

Adding an SSH key to the SSH Agent

The following instructions are for a Mac, using the standard Mac OS version of ssh-add. Make sure to use that version instead one you might have installed with Macports or Homebrew.

First add some instructions to your ~/.ssh/config file which tells the SSH Agent to automatically load the keys and store the corresponding passphrases in your Mac OS keychain:

Host *
 UseKeychain yes
 AddKeysToAgent yes
 IdentityFile ~/.ssh/id_rsa
Next add your private key to the SSH Agent:
$ ssh-add -K ~/.ssh/id_rsa
Finally you can check if the agent successfully stored the key by listing all identities:
$ ssh-add -l