Overview

You need an SSH key pair in order to authenticate against Beach services or for logging in into a 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

If you need to add your public SSH key to some service (Beach, GitHub, …) can also easily get the needed data. Just run the following command and copy the output:

$ ssh-add -L
ssh-rsa AAAAB3Nza…more data here …Rf2pgpt16xw== you@some.machine