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

# How to generate and add an SSH key on Linux

> Generate an ed25519 SSH key on Linux with ssh-keygen and add the public key to Compute with Hivenet so you can connect to instances securely.

## What you’ll need

* A Hivenet account with Compute credits ready
* A Debian-, Ubuntu-, Fedora-, or Arch-based distro (others work too)
* **OpenSSH client** (`ssh`) installed
* A terminal emulator

## Step 1 – Create your SSH key pair

```text theme={null}
ssh-keygen -t ed25519
```

* Accept the default path (`/home/<you>/.ssh/id_ed25519`).
* Add a passphrase for extra security.

<Tip>
  Password managers such as 1Password, Bitwarden, and KeePassXC can generate and store SSH keys automatically. If you already rely on one, it’s an easy alternative to the `ssh-keygen` command.
</Tip>

## Step 2 – Find your key files

Open the folder in your file manager:

```text theme={null}
xdg-open ~/.ssh
```

—or browse there manually (`Home → .ssh`). You should see:

* `id_ed25519` (private)
* `id_ed25519.pub` (public)

## Step 3 – Add your public key to Hivenet

1. Copy the public key to your clipboard:

   ```text theme={null}
   cat ~/.ssh/id_ed25519.pub | xclip -selection clipboard
   ```

   \_(If \_`xclip`*isn’t installed, just open the file in a text editor and copy.)*
2. In **Compute with Hivenet**, paste the key into **SSH key** when you spin up an instance.

<Warning>
  Share only the `.pub` key. Keep the private key private.
</Warning>

## Step 4 – (Optional) add a quick SSH config

Create or edit **\~/.ssh/config**:

```text theme={null}
Host hivenet
    HostName YOUR_SSH_HOST
    User YOUR_SSH_USER
    IdentityFile ~/.ssh/id_ed25519
    Port 22
```

Replace `YOUR_SSH_HOST` and `YOUR_SSH_USER` with the values in the instance’s SSH connection details, and use your matching private key. Include any additional settings supplied by the console. See [SSH configuration and host verification](/tutorials/more-guides/SSH-config-file-explained).

Connect with:

```text theme={null}
ssh hivenet
```

## Troubleshooting

| Message | Likely cause & fix |
| :- | :- |
| **Permission denied (publickey)** | Wrong key or the public key isn’t on the instance. Re-check the key path or re-add the key. |
| **Connection timed out** | Check the console’s connection details and outbound port 22. Try `ssh -v hivenet` for details. |
| **ssh: command not found** | Install the OpenSSH client package (`install openssh-client`, `sudo dnf install openssh-clients`, etc.). |


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