remote-script-exec

Executes non-trivial remote commands by writing scripts locally, scp-ing them over, and running them via ssh.

Updated Jul 20, 2026
One-click install
npx skills add https://github.com/peachest/skills --skill remote-script-exec-peachest
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: remote-script-exec
Source: https://github.com/peachest/skills/tree/main/in-progress/remote-script-exec
Command: npx skills add https://github.com/peachest/skills --skill remote-script-exec-peachest

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Inline ssh commands with nested quotes, heredocs, or variable substitution fail unpredictably due to multi-layer quoting, and long remote waits get killed by local tool timeouts. This Skill replaces fragile inline ssh strings with a scp-first pattern: write the script locally, upload it, execute it remotely, and iterate by re-uploading. ## Core Features & Use Cases - Scp-first execution pattern: Write scripts locally with node-prefixed names (~/tmp/<node>_<task>.py), scp them to the remote node, and run them there, keeping the local file as the source of truth. - First-contact probing: Run one cheap BatchMode ssh probe to determine reachability and auth mode before sending real work to an unfamiliar node. - Timeout and background-job discipline: Wrap remote waits in a remote timeout, and separate nohup background launches from later verification steps so local tool timeouts never kill a session mid-wait. - Credential hygiene: Never inline passwords in commands; prefer ~/.ssh/config Host aliases with key auth, or sshpass -e with an environment variable. - Use Case: Deploying a long-running data collector to an unfamiliar node — package the source and a deploy script locally, scp the tarball over, create a venv remotely, launch with nohup, verify output grows, then scp results back for local analysis. ## Quick Start Use the remote-script-exec skill to run this multi-line diagnostic script on node gpu-03 instead of inlining it through ssh.

Frequently Asked Questions about remote-script-exec

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run a multi-line script on a remote server over ssh?▼

Write the script locally, upload it with scp, then execute it with ssh, for example scp script.py user@node:/tmp/ followed by ssh user@node 'python3 /tmp/script.py'. Iterate by editing the local file and re-uploading rather than patching the remote copy.

Why does my inline ssh command with quotes or heredocs fail?▼

Each nesting layer consumes one quoting level: the outer bash single quotes, the remote shell re-parsing, and embedded content like python f-strings or sed expressions. Three layers deep nothing parses, so escalate to the scp-first pattern on the first quoting failure instead of retrying inline.

How do I check ssh connectivity and auth before running remote commands?▼

Run one cheap probe: ssh -o BatchMode=yes -o ConnectTimeout=5 user@node 'hostname'. Success means key auth works, Permission denied means a password flow is needed, and a timeout means the node is unreachable.

How do I run a long-running background job on a remote host with nohup?▼

Launch with nohup ... > run.log 2>&1 & echo "pid=$!" and exit immediately, then verify the pid and growing output file in a separate later ssh. Never bundle launch, sleep, and checks into one ssh string or the local tool timeout will kill the session.

Is it safe to use sshpass -p with an inline password?▼

No. Inline passwords persist in session logs and can leak into shared or public repositories. Prefer ~/.ssh/config Host aliases with key auth, and when sshpass is unavoidable, export the password into the environment and use sshpass -e.

When is inline ssh acceptable instead of scp-first?▼

Inline ssh is fine only for a single trivial command with no nested quotes and no multi-statement chaining, such as ssh node 'ls /tmp'. Loops, pipes with quotes, python one-liners, and heredocs should all go through the scp-first pattern.