ssh-server-admin
SSH Server Administration
Comprehensive skill for secure remote server management via SSH. Cross-platform compatible: Windows, macOS, and Linux.
Platform Detection
Detect the operating system first to use the correct SSH approach:
- Windows: Use PowerShell or Windows OpenSSH (built into Windows 10+)
- macOS/Linux: Use standard bash SSH commands
Authentication Methods
1. SSH Key Authentication (Recommended)
Check for existing keys:
# Windows (PowerShell)
Get-ChildItem ~/.ssh/id_*.pub
# macOS/Linux
ls -la ~/.ssh/id_*.pub
If keys exist, use them:
ssh -o StrictHostKeyChecking=accept-new [username]@[host] "[command]"
If no keys exist, create them:
# All platforms
ssh-keygen -t ed25519 -C "user@example.com"
# Copy public key to server
ssh-copy-id -i ~/.ssh/id_ed25519.pub [username]@[host]
2. Password Authentication
macOS/Linux with sshpass:
sshpass -p '[password]' ssh -o StrictHostKeyChecking=accept-new [username]@[host] "[command]"
Windows (Python helper):
python scripts/ssh_helper.py --host [host] --user [username] --password [password] --command "[command]"
Credential Collection
When user first requests SSH operation, collect credentials ONCE:
I need SSH connection details:
1. Host/IP Address: (e.g., 192.168.1.100 or server.example.com)
2. Username: (e.g., root, admin, ubuntu)
3. Authentication Method: SSH Key (recommended) or Password
4. Port (optional): Default is 22
Store credentials in working memory for the session. NEVER write to files or logs.
Common Commands
Remote Command Execution
ssh -o StrictHostKeyChecking=accept-new -o ConnectTimeout=30 [username]@[host] "[command]"
File Transfer (SCP)
# Upload file
scp -o StrictHostKeyChecking=accept-new [local_file] [username]@[host]:[remote_path]
# Download file
scp -o StrictHostKeyChecking=accept-new [username]@[host]:[remote_file] [local_path]
Port Forwarding
# Local port forwarding (access remote service locally)
ssh -L [local_port]:localhost:[remote_port] [username]@[host]
# Remote port forwarding (expose local service remotely)
ssh -R [remote_port]:localhost:[local_port] [username]@[host]
# Dynamic SOCKS proxy
ssh -D [local_port] [username]@[host]
Server Administration Tasks
System Information
ssh user@host "uname -a && cat /etc/os-release" # System info
ssh user@host "df -h" # Disk space
ssh user@host "free -h" # Memory usage
ssh user@host "ps aux --sort=-%mem | head -20" # Top processes
ssh user@host "uptime && top -bn1 | head -15" # System load
Service Management (systemd)
ssh user@host "systemctl status [service_name]"
ssh user@host "sudo systemctl start|stop|restart [service_name]"
ssh user@host "journalctl -u [service_name] -n 50 --no-pager"
Log Analysis
ssh user@host "sudo tail -100 /var/log/syslog"
ssh user@host "sudo grep -i error /var/log/syslog | tail -50"
ssh user@host "sudo tail -50 /var/log/auth.log"
Network Diagnostics
ssh user@host "ss -tulpn" # Listening ports
ssh user@host "netstat -an | grep ESTABLISHED" # Active connections
ssh user@host "ping -c 3 [target] && traceroute [target]"
Configuration Options
| Option | SSH Flag | Description |
|---|---|---|
| Custom port | -p [port] |
Non-standard SSH port |
| Timeout | -o ConnectTimeout=[sec] |
Connection timeout |
| Compression | -C |
Enable compression |
| Verbose | -v or -vv |
Debug output |
| Identity file | -i [path] |
Specific SSH key |
| Batch mode | -o BatchMode=yes |
Fail instead of prompting |
Troubleshooting
| Issue | Solution |
|---|---|
sshpass: command not found (Windows) |
Use Python helper or set up SSH keys |
sshpass: command not found (macOS) |
brew install hudochenkov/sshpass/sshpass |
sshpass: command not found (Linux) |
apt install sshpass or yum install sshpass |
| Permission denied | Check username/password/key, verify auth method |
| Connection refused | Verify host/port, check if SSH service running |
| Host key changed | Server reinstalled - verify and update known_hosts |
| Connection timeout | Check network, firewall rules |
When to Use This Skill
- "SSH into my server at 192.168.1.100"
- "Connect to my remote machine"
- "Run a command on the server"
- "Upload/download files to/from the server"
- "Set up port forwarding"
- "Create an SSH tunnel"
- "Check server status"
- "Restart a service on the server"
- "View server logs"
When NOT to Use This Skill
- Local file operations (no SSH needed)
- Cloud provider API operations (use their CLIs)
- Database client connections (use database tools)
Security Best Practices
- Prefer SSH keys over passwords
- Never echo passwords in command output
- Use StrictHostKeyChecking appropriately
- Limit key permissions -
chmod 600 ~/.ssh/id_* - Use agent forwarding carefully -
-Aflag
More from housegarofalo/claude-code-base
mqtt-iot
Configure MQTT brokers (Mosquitto, EMQX) for IoT messaging, device communication, and smart home integration. Manage topics, QoS levels, authentication, and bridging. Use when setting up IoT messaging, smart home communication, or device-to-cloud connectivity. (project)
22devops-engineer-agent
Infrastructure and DevOps specialist. Manages Docker, Kubernetes, CI/CD pipelines, and cloud deployments. Expert in GitHub Actions, Azure DevOps, Terraform, and container orchestration. Use for deployment automation, infrastructure setup, or CI/CD optimization.
6postgresql
Design, optimize, and manage PostgreSQL databases. Covers indexing, pgvector for AI embeddings, JSON operations, full-text search, and query optimization. Use when working with PostgreSQL, database design, or building data-intensive applications.
6home-assistant
Ultimate Home Assistant skill - complete administration, wireless protocols (Zigbee/ZHA/Z2M, Z-Wave JS, Thread, Matter), ESPHome device building, advanced troubleshooting, performance optimization, security hardening, custom integration development, and professional dashboard design. Covers configuration, REST API, automation debugging, database optimization, SSL/TLS, Jinja2 templating, and HACS custom cards. Use for any HA task.
6testing
Comprehensive testing skill covering unit, integration, and E2E testing with pytest, Jest, Cypress, and Playwright. Use for writing tests, improving coverage, debugging test failures, and setting up testing infrastructure.
5react-typescript
Build modern React applications with TypeScript. Covers React 18+ patterns, hooks, component architecture, state management (Zustand, Redux Toolkit), server components, and best practices. Use for React development, TypeScript integration, component design, and frontend architecture.
5