On this page
Sommatic Docs
Open portal

SSH Command

Execute commands on remote server via SSH.

View as Markdown
Open in
Input and output Available io.ssh Version 1.0.0 Execution: async

Opens an SSH session with a credential, runs one command on the remote host and returns its output and exit code.

How it works

  1. Resolves the config. connection_id and command fall back to the same keys of the incoming payload; both are required.
  2. Resolves the credential: host and port (default 22) from its config; username, password, privateKey and passphrase from its secret.
  3. Connects, runs command in an exec channel and collects stdout and stderr until the channel closes.
  4. Exit code 0 leaves through out with { stdout, code, signal }; any other code through error with { stdout, stderr, code, signal }.

In a workflow

The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.

{
  "node_id": "node-check-disk",
  "label": "Check disk usage",
  "operator_slug": "io.ssh",
  "operator_version": "1.0.0",
  "config": {
    "connection_id": "pi-credential-xxxx",
    "command": "df -h /"
  }
}

Configuration

connection_id string Required

Credential for the SSH target. Accepts credentials of type `basic-auth` (username + password + host), `certificate` (username + private key), or `object` (advanced SSH config).

command string Required

Shell command to execute

Behaviour in the code

What the implementation does with these keys beyond what the schema says.

connection_id
Accepts basic-auth (username + password), certificate (username + privateKey, optional passphrase) or object credentials, with host and port in the config. A JSON value { host, port, username, password, privateKey, passphrase } is accepted in place for local tests.
command
Executed by the remote user's shell exactly as written after expressions are resolved.

Output ports

out default

The remote command exited with code 0. stderr is not included on this port.

Data
{
  "stdout": "Filesystem  Size  Used Avail Use%\n/dev/sda1    50G   21G   27G  44%\n",
  "code": 0,
  "signal": null
}
error

The command exited non-zero (data is { stdout, stderr, code, signal }), or the connection, authentication or exec channel failed (data is { error }).

Data
{
  "stdout": "",
  "stderr": "systemctl: unit not found\n",
  "code": 5,
  "signal": null
}

In expressions

What a later node can read from this node's output with $("SSH Command").item.json.<path> (write your node's label instead of SSH Command). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through out, from the output shown in Ports.

ExpressionEditorWorker
$("SSH Command").item.json.stdoutstring= "Filesystem Size Used Avail Use%\n/dev/sda1…"
$("SSH Command").item.json.codenumber= 0
$("SSH Command").item.json.signalstring= null

Errors

Message Port Cause and fix
All configured authentication methods failed error The server rejected the user, password or private key of the credential.
Timed out while waiting for handshake error The host did not answer the SSH handshake. Check host, port and that the orchestrator can reach it.
command is required error No command in the config nor in the incoming payload (connection_id is required is the equivalent for the credential).
connection_id parece una cadena cruda pero no es JSON válido: <value> error connection_id starts with { or names a local host but is not valid JSON. Select a stored credential instead.

Input contract

connection_id string Required
command string Required

Output contract

stdout string Optional
code number Optional
signal string Optional

Contracts (JSON Schema)

The definition exactly as the orchestrator declares it. All is the whole *.definition.js; compare it with the sections above to spot differences between the documentation and the schema. Use it to validate a node before you publish.

{
  "slug": "io.ssh",
  "name": "SSH Command",
  "category": "io",
  "version": "1.0.0",
  "description": "Execute commands on remote server via SSH.",
  "capabilities": [
    "ssh",
    "infrastructure",
    "linux"
  ],
  "config_schema": {
    "type": "object",
    "properties": {
      "connection_id": {
        "type": "string",
        "title": "SSH Credential",
        "description": "Credential for the SSH target. Accepts credentials of type `basic-auth` (username + password + host), `certificate` (username + private key), or `object` (advanced SSH config).",
        "ui_widget": "connection_picker",
        "ui_options": {
          "credential_types": [
            "basic-auth",
            "certificate",
            "object"
          ],
          "types": [
            "ssh"
          ]
        }
      },
      "command": {
        "type": "string",
        "description": "Shell command to execute"
      }
    },
    "required": [
      "connection_id",
      "command"
    ]
  },
  "input_contract_schema": {
    "type": "object",
    "properties": {
      "connection_id": {
        "type": "string"
      },
      "command": {
        "type": "string"
      }
    },
    "required": [
      "connection_id",
      "command"
    ]
  },
  "output_contract_schema": {
    "type": "object",
    "properties": {
      "stdout": {
        "type": "string"
      },
      "code": {
        "type": "number"
      },
      "signal": {
        "type": "string"
      }
    }
  },
  "ports": [
    {
      "port_id": "out",
      "label": "Output",
      "description": "Command stdout",
      "is_default": true,
      "supports_condition": true
    },
    {
      "port_id": "error",
      "label": "Error",
      "description": "Command stderr or connection failure",
      "is_default": false,
      "supports_condition": false
    }
  ],
  "execution_mode": "async",
  "required_resources": [],
  "compatible_worker_pools": [
    "standard-io",
    "infra"
  ],
  "tags": [
    "ssh",
    "terminal",
    "bash"
  ],
  "is_stateful": false,
  "publisher": {
    "identity": "org_link_loom",
    "profile": {
      "name": "Link Loom",
      "verified": true,
      "url": "https://me.veripass.com/link-loom",
      "logo_url": null
    }
  }
}

Execution

Execution
async
Stateful
No
Credentials
Resolved on the server from connection_id; the secret never reaches the workflow.
Capabilities
sshinfrastructurelinux
Tags
sshterminalbash

Notes and limits

  • No command timeout: a command that never ends keeps the node waiting. The library waits about 20 s for the handshake.
  • No pseudo-terminal is allocated, so interactive commands (prompts, sudo asking for a password) do not work.
  • One connection per run, closed when the command ends. No retries.

Reviewed against the orchestrator code · 31e874b · 2026-11-26

Install agent tools

Give your coding agent the official Sommatic AI docs: skills, the docs MCP server and Markdown pages, so it never has to scrape the site.

Skills only. They do not update by themselves; run it again to refresh.

npx skills add https://docs.sommatic.ai
How agents read these docs