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

# SSH

## `core.ssh.execute_command`

Execute a command over SSH and return stdout, stderr, and exit status.

### Secrets

Required secrets:

* `ssh`: required values `PRIVATE_KEY`.

### Inputs

<ParamField path="command" type="string" required>
  Command to execute on the remote host.
</ParamField>

<ParamField path="host" type="string" required>
  SSH host to connect to.
</ParamField>

<ParamField path="host_public_key" type="string" required>
  Expected public host key for the target host in '\<key\_type> \<base64>' format. For non-22 ports, the entry is stored as \[host]:port.
</ParamField>

<ParamField path="username" type="string" required>
  SSH username.
</ParamField>

<ParamField path="password" type="string | null">
  Password for the SSH user.

  Default: `null`.
</ParamField>

<ParamField path="port" type="integer">
  SSH port. Defaults to 22.

  Default: `22`.
</ParamField>

<ParamField path="timeout_seconds" type="number">
  Timeout in seconds for connection and command execution.

  Default: `30.0`.
</ParamField>

### Examples

**Execute a remote command**

```yaml theme={null}
- ref: collect_uptime
  action: core.ssh.execute_command
  args:
    host: 10.0.10.15
    port: 22
    username: tracecat
    host_public_key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBEXAMPLEHOSTKEY"
    command: uptime
    timeout_seconds: 20
```
