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.

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
Modelopus
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

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 statusFree
CREATEmkdir, touch, docker pullFree if non-destructive
MODIFYchmod, config edits, sedAskUserQuestion
SERVICErestart, reload, docker compose upAskUserQuestion
DELETErm, docker rm, docker volume rmAlways AskUserQuestion
PRIVILEGEsudo, firewall rules, user managementAlways AskUserQuestion

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.