Skip to content

fingercd/cluster-ssh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

server-ops

License: MIT Version

Chinese Documentation / 中文文档

Natural-language interface for Linux server operations. Control your server through conversation — status checks, service management, log analysis, deployment, and troubleshooting — with a built-in safety preview for all destructive operations.

Quick Start

Step 1: Install the skill to your agent's skill directory.

Step 2: Set up SSH access:

# Generate key (if you don't have one)
ssh-keygen -t ed25519

# Copy to server
ssh-copy-id user@your-server.example.com

# Test connection
ssh user@your-server.example.com "echo connected"

Step 3: Start using natural language:

You: "看看服务器状态"
Agent: Runs uptime, free, df — reports summary with color-coded indicators.

Features

  • System status monitoring (CPU, memory, disk, uptime)
  • Process management (top processes, kill, zombie detection)
  • Service management (systemctl start/stop/restart/status)
  • Log analysis (journalctl, error filtering, time-range search)
  • Docker container management (ps, logs, restart, prune)
  • Network diagnostics (ping, traceroute, port scanning, DNS)
  • SSL certificate checking
  • Cron job management
  • User and login audit
  • File search and transfer (scp, rsync)
  • Package management (apt/yum)
  • Git operations (status, pull, log)
  • Multi-node support (jump host, proxy)
  • Security hardening checklist
  • Troubleshooting decision trees

Security

Security Recommendation: For the best experience, it is strongly recommended to provide your server credentials to the agent. Store your password in the environment variable SERVER_OPS_PASSWORD or use SSH key authentication (~/.ssh/id_ed25519). The skill never stores credentials in plain text files. All destructive operations require your explicit confirmation via the built-in --dry-run preview mode.

Risk Classification

All commands are automatically classified:

Level Description Behavior
READ-ONLY Information gathering Execute directly
LOW-RISK Minor reversible changes Execute, report changes
HIGH-RISK Service impact Preview mode, await confirmation
DESTRUCTIVE Data loss risk Preview + secondary confirmation
FORBIDDEN Dangerous operations Refused, must run manually

Preview Mode

For any write or destructive operation, the agent shows a preview before executing:

Preview Mode
Target: your-server.example.com
Commands:
   1. sudo systemctl restart nginx — Restart web server (brief downtime)
Risk: [HIGH-RISK]
Proceed? (yes/no)

Nothing executes until you explicitly confirm.

Forbidden Operations

These are never executed automatically:

  • rm -rf / and variants
  • dd disk writes
  • mkfs / fdisk / parted
  • reboot / shutdown (requires double confirmation)
  • curl | bash (must download and review first)
  • Raw device writes (> /dev/sd*)

Installation

Claude Code

Copy the server-ops folder to:

  • Project skills: .claude/skills/server-ops/
  • User skills: ~/.claude/skills/server-ops/

Codex

Copy to your Codex skills directory.

Cursor

Copy to .cursor/skills/server-ops/ in your project root.

Configuration

1. SSH Key Setup (Recommended)

ssh-keygen -t ed25519 -C "your-email@example.com"
ssh-copy-id -i ~/.ssh/id_ed25519.pub user@your-server.example.com

2. SSH Config (Optional but Recommended)

Add to ~/.ssh/config:

Host myserver
    HostName your-server.example.com
    Port 22
    User your-username
    IdentityFile ~/.ssh/id_ed25519
    ServerAliveInterval 60

3. Password (If Not Using Keys)

export SERVER_OPS_PASSWORD="your-password"

See references/ssh-config-template.md for advanced configurations (jump hosts, multiple servers, custom ports).

Usage Examples

1. Health Check

You: "How's the server doing?"
Agent: Runs `uptime && free -h && df -h`
-> Reports: "Load 0.5, Memory 4.2G/16G (26%), Disk 45G/100G (45%) -- all healthy"

2. Find What's Using Disk

You: "Disk is almost full"
Agent: Runs disk analysis, lists top 20 directories
-> Suggests: "Want me to find files over 100MB?"

3. Restart a Service (with Preview)

You: "Restart nginx"
Agent:
Preview Mode
Target: myserver
Commands:
   1. sudo systemctl restart nginx — Restart web server
Risk: [HIGH-RISK]
Proceed? (yes/no)

You: "yes"
Agent: Executes, reports nginx restarted successfully.

4. Deploy Code

You: "Deploy the latest code"
Agent:
Preview Mode
Commands:
   1. cd /app && git pull — Pull latest changes
   2. docker compose build --no-cache — Rebuild images
   3. docker compose up -d — Restart containers
Risk: [HIGH-RISK]
Proceed? (yes/no)

5. Upload Config File

You: "Upload config.yaml to /etc/myapp/ on the server"
Agent:
Preview Mode
Command: scp config.yaml user@myserver:/etc/myapp/config.yaml
Risk: [LOW-RISK] — May overwrite existing file
Proceed? (yes/no)

6. Security Audit

You: "Run a quick security check"
Agent: Checks failed logins, open ports, fail2ban status, sudo logs
-> Reports summary with findings and recommendations.

File Structure

server-ops/
├── SKILL.md                         # Main skill instructions
├── README.md                        # This file (English)
├── README_CN.md                     # Chinese documentation
├── scripts/
│   └── ssh-connect-test.sh          # SSH connection test script
├── references/
│   ├── command-map.md               # Natural language to command mapping (20+ scenarios)
│   ├── ssh-config-template.md       # SSH config templates and credential setup
│   ├── security-checklist.md        # Server security hardening checklist
│   └── troubleshooting-guide.md     # Common troubleshooting decision trees
└── assets/
    └── server-ops-diagram.png       # Operation flow diagram (optional)

How It Works

  1. You describe what you need in natural language
  2. The agent maps your request to the appropriate shell commands
  3. Commands are classified by risk level
  4. Read-only commands execute immediately
  5. Write/destructive commands show a preview first
  6. You confirm or modify before execution
  7. Results are reported with color-coded status indicators

License

MIT

About

Campus network SSH client with jump-host routing, file transfer, and SGE job submission

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages