# Add SSH keys to your servers

Save your public SSH keys in Nuvlo and pick them when you create a server, so you can sign in to that server from your own computer. You'll also learn what happens when you delete a key.

## Before you start

- An SSH key pair on your computer. If you don't have one, create it with `ssh-keygen -t ed25519` in a terminal.
- The **Owner** or **Admin** role. Only they can add or delete SSH keys and add them to new servers. See [Roles and permissions](https://app.nuvlo.dev/docs/roles-and-permissions).

## Which servers get your keys

Saved keys are added to a server when you create it. You choose the keys in the server form, and each selected key can sign in to that server as `root`.

Keys are not added to servers that already exist, and deleting a key in Nuvlo does not remove it from servers created with it. The steps below show how to handle both cases.

Servers created by Nuvlo accept SSH keys only. Signing in with a password is turned off.

## Step 1: Copy your public key

Your public key is the file that ends in `.pub`, for example `~/.ssh/id_ed25519.pub`. Print it and copy the whole line:

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

The line starts with the key type, such as `ssh-ed25519`. Nuvlo accepts Ed25519, RSA and ECDSA keys.

> **Warning:** Never paste your private key, the file without `.pub`. Anyone who has it can sign in to your servers.

## Step 2: Add the key to Nuvlo

In the sidebar, select **Resources** and then **SSH keys**. Click **Add SSH key**.

Enter a **Name** that tells you where the key lives, such as `MacBook Pro`. Paste the line you copied into **Public key** and click **Add key**.

![The Add SSH key page with a name and a pasted public key](https://app.nuvlo.dev/docs/shots/ssh-keys--add.webp)

If the key can't be read, Nuvlo tells you why, for example **Enter one OpenSSH public key (Ed25519, RSA, or ECDSA).** Check that you pasted one complete line.

## Step 3: Check the key in the list

The **SSH keys** page lists every saved key with its **Name**, **Fingerprint** and the date it was **Added**. The fingerprint is a short ID of the key. It starts with `SHA256:`.

![The SSH keys page with a saved key, its fingerprint and the date it was added](https://app.nuvlo.dev/docs/shots/ssh-keys--list.webp)

To compare it with the key on your computer, run:

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

## Step 4: Select the key when you create a server

When you [create a server](https://app.nuvlo.dev/docs/create-a-server), the configuration step has a section **SSH keys (optional)**. Tick every key that should have access.

![The SSH keys section of the server form with one key ticked](https://app.nuvlo.dev/docs/shots/ssh-keys--select-on-create.webp)

When the server is ready, sign in with its IP address from the server's page:

```
ssh root@203.0.113.10
```

## Step 5: Delete a key

On the **SSH keys** page, open the options menu at the end of the key's row and choose **Delete key**. Confirm with **Delete key**.

![The Delete SSH key dialog with the Delete key button](https://app.nuvlo.dev/docs/shots/ssh-keys--delete.webp)

The key can no longer be selected for new servers. Servers that were created with it still accept it.

## Step 6: Revoke a key on an existing server

If a key was lost or someone should no longer have access, remove it from each server it was added to. Open the server's [terminal](https://app.nuvlo.dev/docs/server-terminal) and list the fingerprints of the keys that can sign in:

```
ssh-keygen -lf /root/.ssh/authorized_keys
```

Find the line whose fingerprint matches the key in Nuvlo, then open `/root/.ssh/authorized_keys` in an editor such as `nano` and delete only that line.

> **Warning:** Deleting the other lines can lock Nuvlo out of the server: one of them is the key Nuvlo uses for deploys, backups and updates.

## Add a key to an existing server

Nuvlo can't push a saved key to a server that already exists. Open the server's [terminal](https://app.nuvlo.dev/docs/server-terminal) and append your public key as a new line at the end of `/root/.ssh/authorized_keys`.

---
Source: https://app.nuvlo.dev/docs/ssh-keys
