SSH Admin

Caution

Every destructive command requires explicit confirmation. MODIFY, DELETE, and PRIVILEGE operations pause and ask via AskUserQuestion before touching anything on the remote host. READ and non-destructive CREATE run freely.

Caution

One agent per host. A multi-server, multi-environment or multi-service job is split per target — the agent refuses to loop over your whole fleet in a single run. Ask for “check prod-1” and “check prod-2” as separate tasks, or accept the split proposal it returns.

Tip

Run /brewtools:ssh first to configure server connections. The skill writes CLAUDE.local.md with your server inventory — ssh-admin reads it automatically on every task start. No inventory file? The agent asks for connection details before proceeding.

Quick reference

FieldValue
Modelinherit — runs on the session’s model
ToolsRead, Write, Edit, Bash, Glob, Grep, AskUserQuestion, WebFetch, WebSearch
Triggers”ssh admin”, “server management”, “deploy to server”, “docker on server”
InventoryReads CLAUDE.local.md in project root
Permissiondefault — destructive ops require confirmation
ScopeOne bounded unit per run; one agent per host

Scope guard

The agent sizes the task before it touches a server.

SituationWhat the agent does
Task fits one bounded unit — one deliverable, ~5 files, ~10 stepsRuns it
Bigger, or several independent deliverablesStops before starting, returns a split proposal: 2-N bounded subtasks, each with scope and suggested owner
Several hosts / environments / services in one requestSplit per target — one agent per host, per environment, per service. Never one agent looping over all of them
Scope grows mid-flightStops at the next clean boundary, reports done / remaining / how to split
Brief missing GOAL, SCOPE, CONTEXT, CONSUMER or acceptanceStates the assumption in the report, or asks once. Never invents scope

How this changes your request: instead of “restart the app on all three prod nodes”, phrase it as three tasks (one per node) — or send the broad request, get the split proposal back, and approve it. The result is delivered for the CONSUMER who picks it up next, not for the literal wording.

When to use

  • Server health check — disk, memory, CPU, running containers, failed services
  • Docker deployment — pull image, write compose file, start/update/stop services
  • Firewall changes — UFW rules, port allow/deny, rule review
  • Reverse proxy setup — Caddy or Nginx virtual hosts with auto-TLS
  • Security hardening — SSH config, fail2ban, user/key management
  • Disk cleanup — prune unused Docker layers, locate large directories

Examples

"Check health on prod-server — disk, memory, running containers"

The agent connects via SSH, runs diagnostics (uptime, free -h, df -h, docker ps), and returns a summary table.

"Deploy a Redis container on staging-server, port 6379, with a persistent volume"

Writes a compose file, transfers it via scp, starts the service, verifies the container is running.

"Open port 443 and block all other inbound traffic on web-server"

Reviews current UFW rules, proposes changes, asks for confirmation, applies, verifies with ufw status verbose.

Flow

  1. Load inventory

    Reads CLAUDE.local.md in the project root for host aliases, IP addresses, SSH users, and key paths. If the file is missing, asks for connection details via AskUserQuestion.

  2. Verify SSH

    Runs ssh -o ConnectTimeout=10 -o BatchMode=yes USER@HOST ‘echo OK’ to confirm connectivity. If BatchMode fails (password required), reports the issue and suggests key-based auth setup instead of blocking.

  3. Gather state

    Collects a baseline snapshot — uptime, memory, disk, Docker containers, open ports, failed systemd units. Read-only, no confirmation needed.

  4. Classify and confirm

    Every planned command is classified: READ (free), CREATE (free if non-destructive), MODIFY / SERVICE / DELETE / PRIVILEGE (pause + AskUserQuestion with a description of what will happen). Nothing executes until confirmed.

  5. Execute and verify

    Runs the confirmed commands. Config changes are validated before apply (caddy validate, nginx -t). Services are restarted and re-checked. Credentials are never hardcoded in commands or files.

  6. Report

    Returns a structured summary: server, task description, actions taken, verification results, and final status (Success / Partial / Failed).

Safety rules & internals

Safety classification

ClassExamplesAction
READls, cat, df, docker ps, systemctl status, ufw statusFree
CREATEmkdir, touch, docker pullFree if non-destructive
MODIFYchmod, chown, sed, config editsAskUserQuestion
SERVICErestart, reload, docker compose upAskUserQuestion
DELETErm, docker rm, docker volume rm, dropAlways AskUserQuestion
PRIVILEGEsudo, su, firewall rules, user managementAlways AskUserQuestion

Before any MODIFY / SERVICE / DELETE / PRIVILEGE command on a remote server, the agent describes what will happen and asks for confirmation.

Operational guards

GuardRule
Non-interactive output--no-pager on journalctl/systemctl, bounded log reads (-n 50, --tail 100) — a pager on a remote shell hangs the run
LockoutBefore ufw enable or any sshd/port change: verify the current SSH port is allowed and keep an open session until the new config is proven
Data destructiondocker system prune -af --volumes and rsync --delete are DELETE level — always confirmed, with an explicit statement of what gets removed

SSH connection patterns

PatternCommand
Non-interactivessh -o ConnectTimeout=10 -o BatchMode=yes USER@HOST "command"
Multi-commandssh -o ConnectTimeout=10 -o BatchMode=yes USER@HOST 'cmd1 && cmd2'
File transferscp -o ConnectTimeout=10 FILE USER@HOST:/path/
InteractiveInstruct user: ! ssh USER@HOST in Claude Code prompt

Docker Compose resource limits (Non-Swarm)

services:
  app:
    image: myapp:latest
    mem_limit: 512m
    cpus: 0.5
    restart: unless-stopped

Use mem_limit/cpus — never deploy.resources.* (Swarm-only syntax).

Quick health script

echo "=== Server Health ===" && \
uptime && echo "---" && \
free -h | grep Mem && echo "---" && \
df -h | grep -E '^/dev' && echo "---" && \
docker ps --format 'table {{.Names}}\t{{.Status}}' 2>/dev/null && echo "---" && \
systemctl --failed --no-pager

SSH hardening checklist (/etc/ssh/sshd_config)

SettingValueWhy
PermitRootLoginnoPrevent root SSH
PasswordAuthenticationnoKey-only access
MaxAuthTries3Brute-force limit
PortCustom (e.g. 2222)Reduce scan noise
📟

SSH Skill

Configure server inventory and SSH connections before spawning ssh-admin.

🚀

Deploy Admin

GitHub Actions, workflows, GHCR releases, and CI/CD — pairs with ssh-admin for full deploy pipelines.

🔗

GitHub source

Agent definition, safety rules, and SSH patterns.

📄

Brewtools overview

All brewtools skills and agents in one place.

Updating plugins

Use /brewtools:plugin-update to check and update the brewcode plugin suite in one command. See the FAQ for details.