Skip to Content
Back to Security & API
Security & API

SSH Command Execution API

SSH Command Execution API

The SSH Command Execution API allows you to securely execute approved diagnostic commands on your Scalelite infrastructure for monitoring and troubleshooting purposes.

Security Notice: Only pre-approved commands from a security whitelist can be executed. Dangerous operations like rm, shutdown, passwd, and command chaining are blocked.

Endpoints

1. Execute Command

POST /api/v1/instances/{instance_id}/ssh/execute

2. Get Command History

GET /api/v1/instances/{instance_id}/ssh/history

3. Get Command Templates

GET /api/v1/ssh/templates

Authentication

All endpoints require API key authentication:

X-API-Key: your-api-key-here

Execute Command - Request Body

ParameterTypeRequiredDescription
commandstringYesThe command to execute (must be whitelisted)
targetstringNoTarget: scalelite (default) or BBB server ID
timeoutintegerNoTimeout in seconds (default: 30, max: 120)

Allowed Commands (Whitelist)

CategoryCommands
Dockerdocker ps, docker logs, docker stats --no-stream
Systemdf -h, free -m, uptime, top -b -n 1
Servicessystemctl status, systemctl is-active
Networknetstat -tlnp, ss -tlnp, ping -c 3
System Infocat /proc/cpuinfo, cat /proc/meminfo, hostname
BBBbbb-conf --status, bbb-conf --check, bbb-conf --secret

Blocked Commands

PatternReason
rm -rf, rm -rRecursive deletion - data loss risk
shutdown, reboot, haltSystem control - service disruption
passwd, useradd, userdelUser management - security risk
chmod 777, chownPermission changes - security risk
; and and or pipeCommand chaining - injection risk

Error Responses

StatusDescription
400Command not allowed (blocked by security policy)
401Invalid or missing API key
403API key does not have SSH permissions
404Instance or target server not found
408Command execution timed out
500SSH connection or execution failed

Audit Logging

All command executions are logged to the audit trail with: user, API key, command, target, timestamp, exit code, and output (truncated if exceeds 10KB). Audit logs are retained for 90 days.

Was this article helpful?

Still need help? Contact support

Searching...
Search across meetings, recordings, and participants
Press ESC to close