# Add an SSH key pair to your account

Source: https://docs.quake.ai/docs/tools/add-ssh-key
Markdown: https://docs.quake.ai/docs/tools/add-ssh-key.md

---

# Add an SSH key pair to your account

One of the first things to do in Quake AI is to set up an SSH key pair.

When working with virtual machine (VM) instances in Quake AI, you'll need a way to access the virtual machines from your local computer. One common way to do this is by using an SSH key pair. A key pair is a set of public / private digital keys used to verify your identity. You store the private part of the key pair locally in a secure location, but you'll share the public part of the key pair. A key pair can be generated and stored on your local computer, and you can also use the cloud console interface to generate one.

SSH is an encryption protocol that enables secure communication between systems. You'll use an SSH client on your local computer to connect with a virtual machine.

Once you add a public key or create a key pair in Quake AI, it is associated with your account and you can use it across different projects.

For SSH basics on Windows and macOS, you can consult these vendor tutorials or other resources online:

- [Tutorial: SSH in Windows Terminal](https://learn.microsoft.com/en-us/windows/terminal/tutorials/ssh)
- [SSH on Apple Support](https://discussions.apple.com/search?q=ssh&page=1&perPage=20&content=filterDiscussions&sortBy=relevance&source=aml&origin=asc_serp&searchId=WRY7yoSjTYe-B66FIZuYzw)

For managing key pairs in the console, see the [Compute console: Key Pairs](/reference/compute/console/key-pairs) section in the Cloud Console Guide.


<SshWarning />

## Upload your public key




Follow these instructions if your local computer uses macOS.

Key pairs are typically stored in the `.ssh` directory, which is a hidden directory on your computer. 

You can access this directory from your `/home/<user>/.ssh`. If you’ve never created a key pair, the directory may not yet exist.

1. Open the Terminal application on your computer.
2. Go to the `.ssh` directory by typing:
```bash
cd .ssh
ls
```

Look for the files `id_ed25519` and `id_ed25519.pub`. If they don’t exist, go to the next step to create them.

**Generate a key pair (macOS)**

1. Open the Terminal application.
2. Go to the `.ssh` directory by typing:
```bash
cd .ssh
```

3. Type the following in the terminal:
```bash
ssh-keygen -t ed25519
```

4. When prompted, press 'Enter' instead of providing a file name.
5. Optionally enter a passphrase to secure access to the key.
6. A private key is written to `/home/user/.ssh/id_ed25519` and a public key written to `/home/user/.ssh/id_ed25519.pub`. Type the following to confirm the files exist:
```bash
ls
```

7. Type the following in the terminal.
```bash
ssh-add id_ed25519
```

**Upload a public key (from macOS)**



The Create Keypair dialog shows a **Key Pair Quota** indicator in its top-right corner: the number of key pairs in use against your account limit.



1. In Quake AI, select **Compute** > **Key Pairs**, then select **Create Keypair** to open the Create Keypair dialog.
2. In the **Create Keypair** dialog, select **Import Keypair** for the **Create Type**.
3. For the name, use `id_ed25519`.
4. Open the Terminal application on your computer.
5. Type the following to copy the public key to your clipboard.
```bash
cat ~/.ssh/id_ed25519.pub | pbcopy
```

6. In Quake AI console, paste the public key into the **Public Key** field. Make sure to delete any trailing spaces after you paste the key. If the create operation fails, try again, look for trailing space, and remove it so the line ends with the last character of the key. 
7. Select **OK** to finish.

You'll now see the key pair in the dashboard. Your key pair is associated with your user account in Quake AI, so you’ll be able to use it across projects.




Follow these instructions if your local computer uses Windows (10 or 11).

**Generate a public key (Windows)**

For detailed information, please read the documentation regarding SSH and key pairs from Microsoft: [https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_keymanagement](https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_keymanagement)

You can use a tool such as OpenSSH on Windows. [https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse?tabs=gui](https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse?tabs=gui)

Key pairs are typically stored in the `C:\ProgramData\ssh` directory.

1. Run the following command from an elevated PowerShell prompt on your local computer:
```PowerShell
ssh-keygen -t ed25519
```

2. You'll see the following (where 'username' is your Windows username):
```PowerShell
Generating public/private ed25519 key pair.
Enter file in which to save the key (C:\Users\username/.ssh/id_ed25519):
```

3. Type 'Enter' to accept the default file name.
4. You can optionally add a passphrase. You can leave it empty for this example.

5. Look for the public key generated in the command line:
```PowerShell
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\username/.ssh/id_ed25519.
Your public key has been saved in C:\Users\username/.ssh/id_ed25519.pub.
The key fingerprint is:
SHA256:OIzc1yE7joL2Bzy8!gS0j8eGK7bYaH1FmF3sDuMeSj8 username@LOCAL-HOSTNAME

The key's randomart image is:
+--[ED25519 256]--+
|        .        |
|         o       |
|    . + + .      |
|   o B * = .     |
|   o= B S .      |
|   .=B O o       |
|  + =+% o        |
| *oo.O.E         |
|+.o+=o. .        |
+----[SHA256]-----+
```

6. Copy the key fingerprint. You'll use this value in the next step.

**Upload a public key (Windows)**



The Create Keypair dialog shows a **Key Pair Quota** indicator in its top-right corner: the number of key pairs in use against your account limit.



1. In Quake AI, select **Compute** > **Key Pairs**, then select **Create Keypair** to open the Create Keypair dialog.
2. In the **Create Keypair** dialog, select **Import Keypair** for the **Create Type**.
3. For the name, use `id_ed25519`.
4. In Quake AI console, paste the public key into the **Public Key** field. Make sure to delete any trailing spaces after you paste the key. If the create operation fails, try again, look for trailing space, and remove it so the line ends with the last character of the key. 
5. Select **OK** to finish.



You'll now see the key pair in the dashboard. Your key pair is associated with your user account in Quake AI, so you’ll be able to use it across projects.

## Generate a key pair in the console



The Create Keypair dialog shows a **Key Pair Quota** indicator in its top-right corner: the number of key pairs in use against your account limit.



1. In Quake AI, select **Compute** > **Key Pairs**, then select **Create Keypair** to open the Create Keypair dialog.
2. In the **Create Keypair** dialog, select **Create Keypair** for the **Create Type**.
3. Provide a name for the key pair.
4. Select **OK**. The key pair `<NAME>.pem` file will download to your local computer. The `.pem` file contains your key pair as a certificate file.

If your local computer uses macOS, follow these instructions to use the key pair locally.

1. Open the Terminal application.
2. Go to the directory containing the downloaded `.pem` file.
3. Type the following in the terminal.
```bash
ssh-add <NAME>.pem
```

## Next steps
You can use different key pairs for different use cases. The key pairs will follow you across projects, so you don't need to generate new keys if you switch. 

If you create a virtual machine, you'll be asked to provide a key pair as a part of the creation process. If you've followed the steps in this example, you'll have a key pair ready for use.

See also:

* [Create a virtual machine password](/docs/compute/how-to/create-password)
* [Quickstart](/docs/quickstart)
