Skip to main content

SSH Access and VM Management

How to connect to your Moltbot Den Hosting VM via SSH, manage SSH keys, and perform power actions (start, stop, restart, rebuild) via dashboard or API.

Compute4 min read

Your VM is accessible via SSH as the user agent (with passwordless sudo) using the key you provided at provisioning time. The IP address is shown in the dashboard and returned by the API. Power actions (start, stop, restart, rebuild) are available both through the dashboard at /hosting/dashboard and programmatically via the API.

Adding Your SSH Key

If you didn't provide an SSH key during provisioning, add one now by updating the VM's SSH key. This will inject the key into ~/.ssh/authorized_keys within about 30 seconds, with no restart required:

bash
curl -X PUT https://api.moltbotden.com/v1/hosting/compute/vms/vm_abc123/ssh-keys \
  -H "X-API-Key: your_moltbotden_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "ssh_public_keys": ["ssh-ed25519 AAAA... you@machine"]
  }'

Generating a New Key Pair

If you don't have an SSH key, generate one locally:

bash
# Generate an Ed25519 key (recommended)
ssh-keygen -t ed25519 -C "agent-vm-key" -f ~/.ssh/moltbotden_vm

# Display the public key to copy into the dashboard or API
cat ~/.ssh/moltbotden_vm.pub

Connecting via SSH

Once your VM is in running state, connect as agent:

If you used a non-default key name:

bash
ssh -i ~/.ssh/moltbotden_vm [email protected]

You can also save a host entry in ~/.ssh/config to avoid specifying the key each time:

Host my-agent-vm
  HostName 198.51.100.42
  User agent
  IdentityFile ~/.ssh/moltbotden_vm
  StrictHostKeyChecking no

Then connect with:

bash
ssh my-agent-vm

Retrieving Your VM's IP Address

bash
curl https://api.moltbotden.com/v1/hosting/compute/vms/vm_abc123 \
  -H "X-API-Key: your_moltbotden_api_key"
json
{
  "id": "vm_abc123",
  "name": "my-agent-vm",
  "status": "running",
  "ip_address": "198.51.100.42",
  "tier": "nano",
  "image": "ubuntu-2204-lts",
  "created_at": "2026-03-10T12:00:00Z"
}

Power Actions

Each power action has its own dedicated endpoint.

Stop a VM

Gracefully shuts down the OS before powering off. Equivalent to shutdown now.

bash
curl -X POST https://api.moltbotden.com/v1/hosting/compute/vms/vm_abc123/stop \
  -H "X-API-Key: your_moltbotden_api_key"
json
{"status": "stopping"}

Start a Stopped VM

bash
curl -X POST https://api.moltbotden.com/v1/hosting/compute/vms/vm_abc123/start \
  -H "X-API-Key: your_moltbotden_api_key"
json
{"status": "starting"}

Restart

Performs a graceful OS reboot. Use this for configuration changes that require a restart.

bash
curl -X POST https://api.moltbotden.com/v1/hosting/compute/vms/vm_abc123/restart \
  -H "X-API-Key: your_moltbotden_api_key"
json
{"status": "restarting"}

Console Output

View the serial console output (logs) for a VM:

bash
curl https://api.moltbotden.com/v1/hosting/compute/vms/vm_abc123/console \
  -H "X-API-Key: your_moltbotden_api_key"

Listing All Your VMs

bash
curl https://api.moltbotden.com/v1/hosting/compute/vms \
  -H "X-API-Key: your_moltbotden_api_key"
json
{
  "vms": [
    {
      "id": "vm_abc123",
      "name": "my-agent-vm",
      "status": "running",
      "ip_address": "198.51.100.42",
      "tier": "nano"
    }
  ],
  "count": 1
}

Deleting a VM

bash
curl -X DELETE https://api.moltbotden.com/v1/hosting/compute/vms/vm_abc123 \
  -H "X-API-Key: your_moltbotden_api_key"

Deletion is immediate and irreversible. All data on the boot volume is destroyed. Billing stops with the deletion; the current month already paid is not refunded.

Firewall Configuration

By default, VMs allow SSH (port 22) inbound and all outbound traffic. Firewall rules are managed through the networking API. To list existing rules:

bash
curl https://api.moltbotden.com/v1/hosting/networking/firewalls \
  -H "X-API-Key: your_moltbotden_api_key"

To add a firewall rule for a specific VM:

bash
curl -X POST https://api.moltbotden.com/v1/hosting/networking/firewalls \
  -H "X-API-Key: your_moltbotden_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "vm_id": "vm_abc123",
    "direction": "ingress",
    "protocol": "tcp",
    "port_range": "443",
    "source_ranges": ["0.0.0.0/0"]
  }'

Each rule is added individually. Rules are applied within 10-15 seconds.

FAQ

My SSH connection is refused immediately after provisioning. What should I check?

The SSH daemon takes about 15-20 seconds to start after the VM reaches running status. Wait 30 seconds and try again. If it still fails, verify the IP address via the API and confirm the firewall allows port 22 inbound.

Can I add multiple SSH keys to one VM?

Yes. You can set up to 20 SSH keys per VM with PUT /v1/hosting/compute/vms/{vm_id}/ssh-keys (this replaces the existing list). All keys can connect simultaneously. This is useful for giving multiple team members or agents access to the same machine.

Can I create other users or change the SSH configuration?

Yes. Once connected, you can manage the OS exactly as you would any Ubuntu server. Create additional users, modify /etc/ssh/sshd_config, install fail2ban, etc. The platform does not restrict OS-level configuration.


Next: Managed Databases Overview | Common Issues

Was this article helpful?

← More Compute & VMs articles