ssh-executor
by @rickkbarbosa
Execute commands on remote hosts over SSH using SSH aliases, ssh config, tmux sessions, and private keys. Use when the user asks to SSH into a host, inspect...
clawhub install ssh-executorπ About This Skill
name: ssh-executor description: Execute commands on remote hosts over SSH using SSH aliases, ssh config, tmux sessions, and private keys. Use when the user asks to SSH into a host, inspect Linux or server state remotely, run one-off remote shell commands, reuse an SSH alias, or drive a tmux-based remote workflow. Prefer for key-based SSH access and remote diagnostics. Do not use for password storage, private-key exfiltration, silent host-key bypass, or destructive changes without explicit confirmation. metadata: { "openclaw": { "os": ["linux", "darwin"], "requires": { "bins": ["ssh", "bash", "python3"] } } }
SSH Executor
Use this skill to run remote commands safely over SSH.
Provenance
.sha256 checksum for the compiled .skill file. Verify before installation.scripts/ssh-run.sh and SKILL.md before first use.Quick start
1. Gather the host alias, username, port, and key path from the user's instructions or local SSH config.
2. Prefer SSH aliases from ~/.ssh/config instead of raw IPs when available.
3. Validate the target host with the user before running any command, especially if the host was inferred or listed from config rather than explicitly requested.
4. Default to read-only commands first.
5. Require explicit user confirmation before destructive or state-changing commands.
6. Use the bundled scripts/ssh-run.sh helper for execution.
7. Return stdout, stderr, exit code, and resolved SSH metadata clearly.
Safety rules
--list-aliases. Do not assume a host is the right target.sudo) needs the user to see and approve the exact command in full before the agent passes --confirm-dangerous.rm, mv, chmod, chown, systemctl restart|stop|disable, reboot, shutdown, package installs/upgrades, docker compose down, schema changes, file writes, or anything using sudo.--confirm-dangerous.Workflow
1. Resolve target
Collect or infer:
If a known SSH alias already exists, prefer it over a raw host/IP.
Only inspect ~/.ssh/config when the user already uses SSH aliases or asks you to resolve them.
To inspect available aliases from the default ssh config:
scripts/ssh-run.sh --list-aliases
To inspect aliases from a custom config file:
scripts/ssh-run.sh --list-aliases --config ~/.ssh/config
2. Decide risk level
hostname, uname -a, uptime, df -h, journalctl -n 100, docker psRead-only commands can usually run immediately. Mutating commands need explicit confirmation.
3. Run command
Use:
scripts/ssh-run.sh --host [--user ] [--port ] [--key ] [--timeout ] [--config ] [--host-key-checking accept-new|yes] -- ''
If the command is mutating and the user explicitly approved it:
scripts/ssh-run.sh --host --confirm-dangerous -- ''
Examples:
scripts/ssh-run.sh --host web-1 -- 'hostname && uptime'
scripts/ssh-run.sh --host 192.168.1.50 --user root --port 2222 --key ~/.ssh/id_ed25519 --timeout 15 --host-key-checking yes -- 'df -h && free -h'
scripts/ssh-run.sh --host prod-app --confirm-dangerous -- 'sudo systemctl restart myapp'
4. Report result
Summarize briefly:
Install and test
This skill lives under the workspace skills/ directory so OpenClaw can discover it in future sessions.
Suggested smoke tests for the bundled helper:
bash -n scripts/ssh-run.sh
scripts/ssh-run.sh --help
scripts/ssh-run.sh --list-aliases
Resources
scripts/ssh-run.sh: key-based SSH wrapper with structured JSON output, alias support, and dangerous-command confirmationreferences/safety.md: extra guidance for safe remote executionπ‘ Examples
1. Gather the host alias, username, port, and key path from the user's instructions or local SSH config.
2. Prefer SSH aliases from ~/.ssh/config instead of raw IPs when available.
3. Validate the target host with the user before running any command, especially if the host was inferred or listed from config rather than explicitly requested.
4. Default to read-only commands first.
5. Require explicit user confirmation before destructive or state-changing commands.
6. Use the bundled scripts/ssh-run.sh helper for execution.
7. Return stdout, stderr, exit code, and resolved SSH metadata clearly.