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

# SSH keys and connecting

> Add an SSH key, turn on SSH for your server, and connect.

You connect to your servers with SSH, using a key instead of a password. The console places your **public** key on a server when the server is created, so add a key **before** you launch one.

## Add an SSH key

Open **Compute → SSH Keys** in the console. You can import a key you already have, or create a new one.

> [tab] Import your existing key (recommended)
>
> If you already have a key on your computer, show its public half:
>
> ```bash theme={null}
> cat ~/.ssh/id_ed25519.pub
> ```
>
> No key yet? Create one first:
>
> ```bash theme={null}
> ssh-keygen -t ed25519 -C "you@example.com"
> ```
>
> Then in **Compute → SSH Keys**, choose **Import**, give the key a name, paste the contents of the `.pub` file, and save.
>
> > [!WARNING]
> >
> > Only ever paste the **public** key, the file ending in `.pub`. Never share or upload your private key.

> [tab] Create a key in the console
>
> In **Compute → SSH Keys**, choose **Create** and give the key a name. Your browser downloads the **private key** file.
>
> > [!WARNING]
> >
> > The private key downloads **once** and can't be downloaded again. Save it somewhere safe.
>
> Move it into place and restrict its permissions (macOS and Linux):
>
> ```bash theme={null}
> mv ~/Downloads/my-key.pem ~/.ssh/
> chmod 600 ~/.ssh/my-key.pem
> ```
>
> On Windows, move it to the `.ssh` folder in your user folder (`%USERPROFILE%\.ssh`). Windows' built-in OpenSSH works with the same commands.

## Connect to your server

You turn on SSH for each server you want to reach, and the console gives you the exact command for it.

**1. Turn on SSH for the server**

Open **Compute → Servers**, open your server, and choose **Actions → Enable SSH**. You can also use the **SSH** switch on the server's row in the list. Confirm.

**2. Copy the command**

After a short wait, the server's **Details** tab shows a **Connect** box with the `ssh` command for this server. Click **Refresh** if it isn't there yet. Copy the command and run it on your computer.

The command expects your private key at `~/.ssh/<key-name>.pem`, named after the SSH key in the console. If you saved it somewhere else, change the path after `-i` to match.

The ready-made images use the user `ubuntu`, and only the private key that matches the SSH key you chose when you created the server can log in. The first time you connect, SSH asks you to confirm the **server's** fingerprint. Type `yes`.

**3. Check the GPU**

```bash theme={null}
nvidia-smi
```

You should see your server's GPU, its memory and the driver version.

### Save the connection once

The **Connect** box also has a section called **Skip the port every time**. It holds a ready-made entry for your SSH config file. Add it to `~/.ssh/config` on your computer, and from then on you only need the server's name:

```bash theme={null}
ssh <server-name>
```

`scp`, `rsync` and VS Code Remote-SSH use the same entry. If your private key isn't at the path in the entry's `IdentityFile` line, change it to match. The Connect box's **Copy files** section has ready-made `scp` and `sftp` commands too.

### Turn SSH off

Choose **Actions → Disable SSH** on the server's page, or use the **SSH** switch in the list. Open sessions end shortly afterwards. The server keeps its SSH command while SSH is off, so the same command works when you turn SSH on again. Deleting a server removes its SSH access automatically.

## Without SSH: the browser console

If SSH doesn't answer, you can still reach a running server from your browser. Open the server's page, click **Console**, then **Open console**. The server's screen opens in a new tab, with keyboard and mouse, as if a monitor were plugged in. To see what the server printed while starting up, use its **Boot log** tab instead.

> [!NOTE]
>
> To sign in through the browser console, the `ubuntu` user needs a password, but the ready-made images only accept SSH keys. If you want the browser console as a backup, set a password first while connected over SSH: `sudo passwd ubuntu`.

## Troubleshooting

| Problem | What to check |
| - | - |
| `Connection refused` | SSH isn't on for this server yet, or was turned on moments ago. Check that the server's **Connect** box shows a command, and use that exact command. |
| No **Enable SSH** action | It's shown only for servers you can change. If SSH is already on, you'll see **Disable SSH** instead. |
| The **SSH** switch is off and greyed out | The server is parked. Resume it, then connect. |
| Enable SSH says "This server is locked by the platform." | [Contact support](https://docs.infinitecompute.ai/guides/getting-help.md) to have it unlocked. |
| `Permission denied (publickey)` | You're using the wrong private key, or it isn't where the command expects it. Use the one that matches the SSH key you chose when you created the server, and check the path after `-i`. If you no longer have that key, you can't log in to that server: launch a new one with a key you have. |
| `REMOTE HOST IDENTIFICATION HAS CHANGED` | You connected to a server that was replaced or recreated. If you're sure it's your new server, run the `ssh-keygen -R` command printed in the warning, then connect again. |
| Connection times out after many quick attempts | Many new connections in a short time are briefly blocked. Wait a minute, then connect once. |
| Enable SSH says "SSH access isn't available for this server's network." | The server is on the wrong network. Launch it again on the network the launch form suggests for its server type. See [Launch a GPU server](https://docs.infinitecompute.ai/guides/launch-gpu-server.md). |
| Enable SSH says "Could not turn on SSH access right now; try again." | Wait a minute and try again. If it keeps failing, [contact support](https://docs.infinitecompute.ai/guides/getting-help.md). |
| `nvidia-smi: command not found` | The server was launched from an image without the NVIDIA driver. Launch it again from a GPU image. |

## Related

> [card] [Launch a GPU server](https://docs.infinitecompute.ai/guides/launch-gpu-server.md)
>
> Pick a server type, an image and a network.

> [card] [Jupyter on your GPU](https://docs.infinitecompute.ai/guides/jupyter.md)
>
> Run notebooks through a secure SSH tunnel.

> [card] [SSH keys](https://docs.infinitecompute.ai/console/ssh-keys.md)
>
> The keys that let you log in.

> [card] [Where your data lives](https://docs.infinitecompute.ai/guides/your-data.md)
>
> What is kept, what is lost, and how to save results.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.