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

# SSH Access

> Connect to your pod via SSH and manage SSH keys.

Every pod has a dedicated SSH port, allowing you to connect directly to your container with any SSH client.

## Connection Details

Find your pod's SSH details on the **SSH** tab of the pod detail page, or via the CLI:

```bash theme={null}
instapods pods get my-app
```

The SSH connection format is:

```bash theme={null}
ssh instapod@<server-host> -p <port>
```

For example:

```bash theme={null}
ssh instapod@nbg1-1.instapods.app -p 2201
```

## Adding SSH Keys

### Via CLI

```bash theme={null}
# Add your default key (~/.ssh/id_ed25519.pub or ~/.ssh/id_rsa.pub)
instapods ssh-keys add my-app

# Add a specific key
instapods ssh-keys add my-app --key ~/.ssh/work_key.pub
```

### Via Dashboard

1. Go to your pod's **SSH** tab
2. Paste your public key in the text field
3. Click **Add Key**

### Via API

```bash theme={null}
curl -X POST https://app.instapods.com/api/pods/my-app/ssh/keys \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"key": "ssh-ed25519 AAAA... user@host"}'
```

### At Pod Creation

You can also include an SSH key when creating a pod:

```bash theme={null}
instapods pods create my-app --preset nodejs --ssh-key ~/.ssh/id_ed25519.pub
```

## Quick Connect via CLI

The CLI has a built-in SSH command:

```bash theme={null}
instapods ssh my-app
```

This looks up the connection details and launches an SSH session automatically.

## Host Key Verification

InstaPods uses **Trust On First Use (TOFU)** for SSH security:

* **First connection**: The host key is automatically accepted and saved to `~/.ssh/known_hosts`
* **Subsequent connections**: The saved key is verified. If it matches, you connect normally
* **Key mismatch**: You'll see a warning. This shouldn't happen for a running pod

When you delete a pod, the CLI automatically removes the old host key from your `known_hosts` file to prevent conflicts when the SSH port is reused.

## SSH Port Allocation

Each pod gets a unique SSH port in the range 2200–3200. Ports are assigned automatically at pod creation. To prevent host key conflicts, deleted pods' ports are not reused for 7 days.

## SCP / SFTP

You can use SCP or SFTP to transfer files:

```bash theme={null}
# Upload a file
scp -P 2201 ./app.js instapod@nbg1-1.instapods.app:/home/instapod/app/

# Download a file
scp -P 2201 instapod@nbg1-1.instapods.app:/home/instapod/app/config.json ./

# Upload a directory
scp -P 2201 -r ./project/ instapod@nbg1-1.instapods.app:/home/instapod/app/
```

Or use SFTP for interactive file management:

```bash theme={null}
sftp -P 2201 instapod@nbg1-1.instapods.app
```
