> For the complete documentation index, see [llms.txt](https://support.spiderpool.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.spiderpool.com/ai/ssh-keys.md). Agents can also search and read this documentation through its [MCP server](https://support.spiderpool.com/~gitbook/mcp).

# SSH keys

Generate and add SSH keys, manage keys when a small team shares one account, and learn when keys are written into your instances.

**Account → SSH keys** ([www.spiderpool.com/ai/account?tab=ssh-keys](https://www.spiderpool.com/ai/account?tab=ssh-keys)) manages the SSH public keys you log in to instances with.

## What an SSH key is for

Logging in to an instance over SSH uses a key pair. You generate it on your own computer: the **private key** stays there, and the **public key** is added here. When an instance starts, the platform writes the public keys of your account into it, so you can `ssh` in with the matching private key.

* **You need at least one key on your account to create or start an instance.** Without one, the Console shows "Add an SSH key before creating an instance." at the top; **Add now** brings you here.
* Never upload or share your private key. This page only needs the public key (the contents of the `.pub` file).

## Generate a key

ed25519 is recommended. If you already have a key (for example `~/.ssh/id_ed25519.pub`), you can use it and skip to "Add a key".

### macOS / Linux

Run this in a terminal and press Enter to accept the default path. Setting a passphrase to protect the private key is recommended:

```bash
ssh-keygen -t ed25519 -C "macbook"
```

Print the public key (copy the whole line):

```bash
cat ~/.ssh/id_ed25519.pub
```

On macOS you can copy it straight to the clipboard:

```bash
pbcopy < ~/.ssh/id_ed25519.pub
```

### Windows (PowerShell)

Windows 10 and 11 include the OpenSSH client. In PowerShell:

```powershell
ssh-keygen -t ed25519 -C "windows-pc"
```

Print the public key, or copy it straight to the clipboard:

```powershell
Get-Content $env:USERPROFILE\.ssh\id_ed25519.pub
Get-Content $env:USERPROFILE\.ssh\id_ed25519.pub | Set-Clipboard
```

A public key is a single line like this:

```
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI... macbook
```

## Add a key

1. Click **Add SSH key** at the top right of the page.
2. In **Name**, enter something that tells you which key this is, for example `macbook` or `alice-laptop`.
3. In **Public key**, paste the whole line (you can use the **Paste** button in the field).
4. Click **Add**. You see "SSH key added" and the key appears in the list.

| Rule            | Details                                                                                                                                                                               |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Name            | Required, at most 64 characters (non-Latin names allow fewer: a Chinese character counts as 3)                                                                                        |
| Supported types | `ssh-ed25519`, `ssh-rsa` (at least 2048 bits), `ecdsa-sha2-*` (such as `ecdsa-sha2-nistp256`). Other types (such as `ssh-dss` or hardware security key `sk-` types) are not supported |
| Format          | A single-line OpenSSH public key: the type, a space and the base64 data, optionally followed by a comment. The comment is not stored; the list uses **Name** to tell keys apart       |
| No duplicates   | The same key (same fingerprint) can be added only once per account                                                                                                                    |

Messages you may see while adding:

| Message                                                                                                                                                         | Cause                                                                      | What to do                                                       |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | ---------------------------------------------------------------- |
| "The key must start with ssh-ed25519 / ssh-rsa / ecdsa-sha2-"                                                                                                   | What you pasted is not a public key, or there is something in front of it  | Copy the whole line of the `.pub` file again                     |
| "must be an OpenSSH public key: ssh-ed25519 / ssh-rsa (>=2048) / ecdsa-sha2-\*" with "paste the complete public key line (starting with ssh-ed25519 / ssh-rsa)" | The key is incomplete or cut off, or the RSA key is shorter than 2048 bits | Copy the complete line; use ed25519 if your RSA key is too short |
| "This key already exists"                                                                                                                                       | The key is already on your account                                         | Nothing to do                                                    |

## Which keys an instance gets

**Every time an instance is created, or a stopped instance is started, the platform writes all keys on your account at that moment into the instance.** While an instance runs, changes to your key list do not reach it:

| What you did  | Running instances                                         | Instances created or started afterwards |
| ------------- | --------------------------------------------------------- | --------------------------------------- |
| Added a key   | Do not get the new key; keep logging in with the old keys | Include the key                         |
| Deleted a key | **The key can still log in** until the instance stops     | No longer include the key               |

* To use a new key on a running instance, keep working with your existing key, or stop and start the instance. A stop and start keeps only the data in `/workspace`, and the start needs free GPUs on the same machine; see [Manage instances](https://support.spiderpool.com/ai/instances.md).
* There is no way to assign keys to a single instance: every key on your account goes into every instance that starts.

{% hint style="danger" %}
If a private key is lost or leaked, deleting its public key does not remove it from instances that are already running. After deleting the key, stop all running instances (you can start them again; restarted instances no longer contain the key) or delete them.
{% endhint %}

## Several people sharing one account

When a small team shares one SpiderAI account:

1. Everyone generates their own key on their own computer. Do not share private keys.
2. Add everyone's public key here, named after the person and device, for example `alice-laptop` or `bob-desktop`.
3. Everyone can then log in with their own private key to the instances created or started from then on.

When someone leaves the team, delete their key, then stop (or delete) all running instances as described above so their key is no longer in any instance.

## Delete a key

1. Click **Delete** next to the key in the list.
2. The **Delete SSH key** dialog asks "Delete key "{name}"?". Click **Delete**.

* If it is your last key and you still have instances, the dialog warns "This is your last key. Without it you cannot create or start instances." Running instances are not affected, but creating a new instance or starting a stopped one requires adding a key first.
* Deleting only affects instances created or started afterwards; see "Which keys an instance gets" above.

## Fingerprints

The list shows each key's **Name**, **Type**, **Fingerprint** and **Added** time. The fingerprint is the SHA256 digest of the key, like `SHA256:AbC…`, and identifies the key. To see the fingerprint of a key on your computer:

```bash
ssh-keygen -lf ~/.ssh/id_ed25519.pub
```

If the part of the output starting with `SHA256:` matches the fingerprint in the list, it is the same key.

## FAQ

**I just added a key. Why can't I log in to my running instance with it?** Keys are written into an instance only when it is created or started. Log in with your previous key, or stop and start the instance.

**Why does a deleted key still work?** A running instance keeps the keys it started with until it stops. To revoke access right away, stop or delete the running instances.

**Can I use an RSA key?** Yes, with at least 2048 bits. For new keys, ed25519 is recommended.

**It says "This key already exists", but I can't tell which entry it is.** Run `ssh-keygen -lf` on your public key and look for the row with the same fingerprint.

**I get `Permission denied (publickey)` when logging in.** Check that the public key matching the private key `ssh` uses is in this list, and that it was added before the instance last started. See [Connect to an instance](https://support.spiderpool.com/ai/connect.md).

## Related

* [Connect to an instance](https://support.spiderpool.com/ai/connect.md)
* [Find GPUs and create an instance](https://support.spiderpool.com/ai/search.md)
* [Manage instances](https://support.spiderpool.com/ai/instances.md)
* [Profile and limits](https://support.spiderpool.com/ai/account.md)
