SSH key setup

🔑

SSH keys setup and intro.

All about SSH keys and how to create an SSH key pair on your local machine.

# About SSH keys

SSH keys are a secure and convenient alternative to passwords. A key pair consists of a public key (shared with the server) and a private key (kept secret). Authentication happens automatically when the server verifies you hold the matching private key.

~/.ssh/
├── id_ed25519        # Private Key (The Key) KEEP SECRET!
├── id_ed25519.pub    # Public Key (The Lock) SHARE
├── id_rsa            # Legacy Private Key
└── id_rsa.pub        # Legacy Public Key
shell

# Do you already have a SSH key?

To see any existing keys, open a terminal to list the ~/.ssh folder:

$ find ~/.ssh
#/…/.ssh/config
#/…/.ssh/id_ed25519      
#/…/.ssh/id_ed25519.pub  
#/…/.ssh/known_hosts
shell

Proceed to the next section if you don't have any key pairs or get an error about a missing folder. If you do see key pairs like above, then you can upload the public SSH key.

# Generate a SSH key pair

# NOTE: me@fortrabbit is just an identifier, use what suits you
$ ssh-keygen -t ed25519 -C me@fortrabbit
# Generating public/private ed25519 key pair.
# Enter file in which to save the key (/home/user/.ssh/id_ed25519):
# Enter passphrase (empty for no passphrase):
# Enter same passphrase again:
shell

We suggest to use me@fortrabbit so that you can identify the key as being associated with your fortrabbit account later on. Use anything you like. It's just a comment.

# Specify a different key than the default

If you use an unprotected key (no passphrase) and still get asked about a password, it may be the case that the key in the default location is not imported into fortrabbit. To use a specific key run SSH like this:

$ ssh -i ~/.ssh/CUSTOM_KEY {{app-env-id}}@ssh.{{region}}.frbit.app
# Replace CUSTOM_KEY with a key on your machine
shell

# SSH keys generation on Windows

The procedure to create SSH keys is slightly different on macOS and Linux compared to Windows. There are different ways to set up and use Git with Windows and also different ways set up and store the keys. We recommend using the official installer from the Git website, together with Git Bash.

# SSH keys under Windows with PuTTY

If you generated an SSH key with PuTTY, you will need to make sure that the private key is saved in the location where git.exe or ssh.exe are looking for it or take steps to specify where the key is. Additionally, PuTTY uses a special format to store the private key, which also requires additional steps to use with other tools. Because of these reasons and previous experience with clients, we advise against using PuTTY.

Found a tpyo?Edit