> ## Documentation Index
> Fetch the complete documentation index at: https://sol.advantagelearn.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Ssh keys

# SSH Keys

SSH keys are a form of access credential used in the [SSH protocol](https://www.ssh.com/academy/ssh/protocol). They come in pairs - a private key and a public key. To authenticate a key, you generally save the **public** key (never the private one) on the service which you are connecting to via SSH. When you are on the machine which has the private key associated with that public key, it will be authenticated.

## Creating an SSH key

<iframe width="708" height="398" src="https://www.youtube.com/embed/FocgH8gTFVw" title="Generating RSA Key Pairs for Mac & Linux | JumpCloud Tutorial" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen />

1. Open your terminal. On macOS, you can find this in **Utilities** in the **Applications** folder.
2. Run the following command in the terminal:

```bash theme={null}
ssh-keygen -t rsa
```

1. It then asks you a couple of questions:
   1. It prompts you about where to store the key, the default location is fine
   2. It prompts you for a passphrase. You can add one or leave this blank
2. After you confirm, it generates the key pairs and stores them in `/Users/<USERNAME>/.ssh/` as `id_rsa` as the private key and `id_rsa.pub` as the public key

## Authenticating with the SSH key

To get the public key, you can run the following command in your terminal:

```bash theme={null}
cat /Users/<USERNAME>/.ssh/id_rsa.pub
```

You will then see a key starting with `ssh-rsa` in your terminal. You can copy and paste that key onto the service you want to authenticate with.
