Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SSH Skill

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.

What Changed in v3.4

  • Added scripts/ssh_session.py for declared multi-step remote workflows.
  • Added ssh_execute.py --stdin-file for commands that safely consume stdin.
  • Added ssh_execute.py --pty for the rare command that requires a pseudo-TTY.
  • Extended daemon execution to support stdin and PTY requests.
  • Rewrote SKILL.md and this README as clean UTF-8 documentation.
  • Added examples/shell_interaction_patterns.md.

Quick Start

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 120

Run a multi-step agent session:

python "${SKILL_DIR}/scripts/ssh_session.py" prod-web-01 --steps-file steps.json --timeout 90

Example steps.json:

{
  "steps": [
    {
      "name": "identity",
      "command": "whoami && hostname"
    },
    {
      "name": "service",
      "command": "systemctl is-active nginx",
      "expect": "active"
    }
  ]
}

Non-Interactive Shell Policy

Do not depend on prompts. Rewrite commands before running them:

  • Use sudo -n instead of waiting for a sudo password.
  • Use DEBIAN_FRONTEND=noninteractive and -y for apt/apt-get.
  • Use -y for yum/dnf when safe.
  • Disable pagers with --no-pager or PAGER=cat.
  • Use heredocs, uploads, or --stdin-file instead of opening editors.
  • Configure ssh-agent for passphrase-protected keys.

Core Scripts

  • 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.

Output Contract

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": []
}

More Examples

See examples/shell_interaction_patterns.md for service checks, apt installs, heredoc edits, controlled stdin, deploy workflows, and prompt recovery patterns.

About

ssh.skill 让远程服务器操作像本地一样简单高效

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages