Skip to main content

Claude Prompt for an SSH Automation Toolkit

Build an SSH automation framework for managing many servers — key rotation, config generation, jump host setup, and parallel batch execution.

Vul de plaatshouders in

Edit the values, then copy your finished prompt.

Jouw Prompt
prompt.txt

                                

What this prompt does

This prompt builds an SSH automation toolkit for managing [server_count] servers across [environment_list]. It generates a ~/.ssh/config from a YAML inventory grouped by environment, rotates Ed25519 keys by distributing new public keys via [current_access_method] and verifying connectivity, provides ssh-batch.sh to run commands in parallel with a [max_parallel] concurrency cap and per-host summary, configures ProxyJump bastion chains for [jump_topology], manages auto-reconnecting tunnels for [tunnel_services], and hardens the SSH client config.

The variables scale the toolkit to your fleet. [server_count] and [environment_list] shape the generated config and grouping, [max_parallel] bounds how aggressively batch commands run, and [jump_topology] plus [tunnel_services] describe how you reach private-subnet hosts. The key-rotation step uses [current_access_method] to push new keys before removing old ones, so you don't lock yourself out mid-rotation. Treating the YAML inventory as the single source of truth is the quiet win here: instead of a hand-edited config that drifts per machine, you regenerate it deterministically, and the same inventory feeds batch execution, bastion chains, and tunnel definitions so everything stays consistent across [environment_list].

When to use it

  • You are past a handful of boxes and hand-editing ~/.ssh/config no longer scales
  • Generating SSH config from a YAML inventory grouped by environment
  • Rotating Ed25519 keys across many servers with connectivity verification
  • Running commands on many hosts in parallel with a concurrency cap
  • Reaching private-subnet servers through ProxyJump bastion chains
  • Maintaining persistent tunnels for [tunnel_services] with auto-reconnect

Example output

Expect a config generator that reads YAML and writes Host aliases grouped by [environment_list], a key-rotation script generating Ed25519 pairs and distributing them, an ssh-batch.sh running with a [max_parallel] cap and a success/failure summary per host, ProxyJump config for [jump_topology], a tunnel manager for [tunnel_services], and hardened client settings. Each is a focused script driven by the inventory.

Pro tips

  • Verify connectivity after distributing new keys before removing old ones; the rotation order via [current_access_method] is what prevents a lockout
  • Set [max_parallel] sensibly — too high and you hammer a shared bastion or trip rate limits, too low and large fleets crawl
  • Keep the YAML inventory as the source of truth so ~/.ssh/config is regenerated, not hand-patched and drifting
  • Define [jump_topology] to match reality (office to bastion to private subnet) so ProxyJump chains actually resolve
  • For [tunnel_services], confirm the auto-reconnect logic backs off; a tight reconnect loop on a down service just spams connection attempts
  • Harden the client config (disable agent forwarding by default, hash known_hosts, strict host key checking) so convenience features do not become a security hole
  • Capture per-host success and failure from ssh-batch.sh rather than a single combined exit code; on a fleet of [server_count] machines you need to know exactly which hosts a command failed on, not just that something failed

Frequently Asked Questions

Will rotating keys lock me out of the servers?
Not if you follow the order the prompt sets: generate new Ed25519 pairs, distribute the public keys via `[current_access_method]`, verify connectivity with the new keys, and only then remove the old ones. Verifying before removal is the safeguard that prevents a mid-rotation lockout.
How does the batch execution avoid overwhelming a bastion?
The `ssh-batch.sh` script runs commands on multiple servers in parallel but caps concurrency at `[max_parallel]`. This limits how many simultaneous connections pass through a shared bastion or hit a rate-limited endpoint, while still being far faster than running commands one host at a time.
Can it reach servers in a private subnet behind a bastion?
Yes. It configures ProxyJump chains matching your `[jump_topology]`, such as office to bastion to private-subnet servers. ProxyJump tunnels the connection through the bastion automatically, so you can SSH to private hosts without manually setting up the intermediate hop each time.
Does it harden the SSH client configuration?
Yes. It disables agent forwarding by default, hashes known_hosts, applies strict host key checking per environment, and sets keep-alive options. These reduce the blast radius if a host is compromised and prevent convenience features like agent forwarding from becoming an attack path.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

Meer in Linux & Shell Scripting Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support