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

# SSH Keys

> Understanding and using SSH keys

SSH (Secure Shell) keys are a secure way to authenticate and connect to remote servers without using passwords. This guide covers what SSH keys are, how to generate them, and how they work with TensorPool.

## What Are SSH Keys?

SSH keys come in pairs:

* **Private Key** - Stays on your local machine and must be kept secret
* **Public Key** - Can be safely shared with servers you want to access

Think of it like a lock and key: the public key is the lock (installed on servers), and the private key is the key (stays with you). When you try to connect, the server uses your public key to verify that you have the matching private key.

## Generating SSH Keys

### For Linux and macOS

Open your terminal and run:

```bash theme={null}
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519
```

You'll be prompted to:

1. Choose a location (press Enter to use the default `~/.ssh/id_ed25519`)
2. Set a passphrase (optional but recommended for extra security)

This creates two files:

* `~/.ssh/id_ed25519` - Your private key (keep this secret!)
* `~/.ssh/id_ed25519.pub` - Your public key (share this with services)

### For Windows

**Option 1: Using Windows Subsystem for Linux (WSL)**

Open WSL terminal and use the same command as Linux/macOS above.

**Option 2: Using PuTTYgen**

1. Download and install [PuTTY](https://www.putty.org/)
2. Open PuTTYgen
3. Click "Generate" and move your mouse to create randomness
4. Save both the private and public keys
5. Copy the public key text from the window

**Option 3: Using Git Bash**

If you have Git for Windows installed, open Git Bash and use the same command as Linux/macOS.

## SSH Key Best Practices

### Security

* **Never share your private key** - Only share the public key (`.pub` file)
* **Use a passphrase** - Adds an extra layer of security
* **Set proper permissions** - Your private key should only be readable by you:
  ```bash theme={null}
  chmod 600 ~/.ssh/id_ed25519
  ```

### Organization

* **Use descriptive names** - If you have multiple keys, name them clearly:
  ```bash theme={null}
  ssh-keygen -t ed25519 -f ~/.ssh/tensorpool_key
  ```
* **Keep backups** - Store your keys securely in case your machine fails

## SSH Keys with TensorPool

### Adding Your SSH Key to Your Account

You can add SSH keys to your TensorPool account in two ways:

**Option 1: Using the CLI**

```bash theme={null}
tp me sshkey add ~/.ssh/id_ed25519.pub --name "joshua"
```

This uploads your public key to your TensorPool account. `--name` is optional but helps you identify keys (recommended if you're in a TensorPool Organization).

**Option 2: Using the Dashboard**

Visit [tensorpool.dev/dashboard/ssh-keys](https://tensorpool.dev/dashboard/ssh-keys) to manage your SSH keys through the web interface. You can add, view, and remove keys from there.

### Why Save Your Public Key to Your Profile?

Once your key is saved to your TensorPool account, it is automatically applied to every new cluster you create. You no longer need to pass `-i` each time:

```bash theme={null}
# Without a saved key — must specify each time
tp cluster create 1xH100 -i ~/.ssh/id_ed25519.pub --name my-cluster

# With a saved key — just create
tp cluster create 1xH100 --name my-cluster
```

You can verify your saved keys at any time:

```bash theme={null}
tp me sshkey list
```

See [account commands](/cli/account-commands#tp-me-sshkey) for the full `tp me sshkey` reference.

## Troubleshooting

### Permission Denied

If you get "Permission denied (publickey)", check that:

1. You're using the correct private key
2. The corresponding public key was added to the cluster
3. Your private key has the correct permissions (`chmod 600`)

### Key Not Found

If SSH can't find your key, specify it explicitly:

```bash theme={null}
ssh -i ~/.ssh/id_ed25519 tensorpool@<cluster_ip>
```

### Multiple Keys

If you have multiple SSH keys, you can configure SSH to use specific keys for specific hosts by editing `~/.ssh/config`:

```
Host *.tensorpool.dev
    IdentityFile ~/.ssh/tensorpool_key
    User tensorpool
```

## Next Steps

* Create your first [cluster](/clusters-quickstart)
* Learn about [cluster management](/features/clusters)
* See the [CLI reference](/cli/ssh-commands)
