Agent-friendly SSH tooling for remote command execution, file transfer, tunnels, jump hosts, cluster operations, and non-interactive shell workflows.
The central design goal is reliability inside AI agent frameworks. Instead of opening a real-time interactive SSH shell, this skill turns remote work into explicit commands, command files, and auditable multi-step sessions with JSON output.
- Added
scripts/ssh_session.pyfor declared multi-step remote workflows. - Added
ssh_execute.py --stdin-filefor commands that safely consume stdin. - Added
ssh_execute.py --ptyfor the rare command that requires a pseudo-TTY. - Extended daemon execution to support stdin and PTY requests.
- Rewrote
SKILL.mdand this README as clean UTF-8 documentation. - Added
examples/shell_interaction_patterns.md.
Run a single command:
python "${SKILL_DIR}/scripts/ssh_execute.py" prod-web-01 "hostname && uptime"Run a complex command from a file:
python "${SKILL_DIR}/scripts/ssh_execute.py" prod-web-01 --command-file check.sh --timeout 120Run a multi-step agent session:
python "${SKILL_DIR}/scripts/ssh_session.py" prod-web-01 --steps-file steps.json --timeout 90Example steps.json:
{
"steps": [
{
"name": "identity",
"command": "whoami && hostname"
},
{
"name": "service",
"command": "systemctl is-active nginx",
"expect": "active"
}
]
}Do not depend on prompts. Rewrite commands before running them:
- Use
sudo -ninstead of waiting for a sudo password. - Use
DEBIAN_FRONTEND=noninteractiveand-yfor apt/apt-get. - Use
-yfor yum/dnf when safe. - Disable pagers with
--no-pagerorPAGER=cat. - Use heredocs, uploads, or
--stdin-fileinstead of opening editors. - Configure ssh-agent for passphrase-protected keys.
scripts/ssh_execute.py: execute one remote command and return JSON.scripts/ssh_session.py: run declared multi-step workflows and return one JSON summary.scripts/ssh_upload.py: upload files/directories.scripts/ssh_download.py: download files/directories.scripts/ssh_server_transfer.py: transfer files directly or through streaming between servers.scripts/ssh_cluster.py: run commands across multiple hosts.scripts/ssh_tunnel.py: manage local port-forwarding tunnels.scripts/ssh_config_manager_v3.py: list, find, create, update, and delete SSH config aliases.scripts/ssh_daemon.py: manage persistent per-alias daemon connections.
Most command scripts return:
{
"success": true,
"exit_code": 0,
"stdout": "...",
"stderr": ""
}ssh_session.py returns:
{
"success": true,
"alias": "prod-web-01",
"failed_step": null,
"steps_total": 2,
"steps_run": 2,
"steps": [],
"suggestions": []
}See examples/shell_interaction_patterns.md for service checks, apt installs, heredoc edits, controlled stdin, deploy workflows, and prompt recovery patterns.