SSH Config for Server Management
Organized SSH config file with host aliases, jump hosts, and connection multiplexing for DevOps.
# ~/.ssh/config
# Global defaults
Host *
ServerAliveInterval 60
ServerAliveCountMax 3
AddKeysToAgent yes
IdentitiesOnly yes
ControlMaster auto
ControlPath ~/.ssh/sockets/%r@%h-%p
ControlPersist 600
# Production servers
Host prod-web
HostName 10.0.1.10
User deploy
IdentityFile ~/.ssh/prod_key
Port 22
Host prod-db
HostName 10.0.1.20
User dbadmin
IdentityFile ~/.ssh/prod_key
LocalForward 5433 localhost:5432
# Staging through jump host
Host staging-*
ProxyJump bastion
User ubuntu
IdentityFile ~/.ssh/staging_key
Host bastion
HostName bastion.example.com
User ops
IdentityFile ~/.ssh/bastion_key
Host staging-web
HostName 172.16.1.10
Host staging-worker
HostName 172.16.1.11
# Quick commands:
# ssh prod-web # Connect to production
# ssh -N prod-db # Port forward only
# ssh staging-web # Auto-jumps through bastion
# mkdir -p ~/.ssh/sockets # Required for ControlPathUse Cases
- Managing connections to multiple servers
- Secure database access via SSH tunneling
- Team SSH configuration standardization
Tags
Related Snippets
Similar patterns you can reuse in the same workflow.
Makefile for DevOps Automation
Makefile with common DevOps targets for building, testing, deploying, and managing Docker containers.
Best for: Standardizing developer commands across teams
Log Rotation Management Script
Automate log rotation with compression, retention policies, and disk space monitoring in Bash.
Best for: Preventing disk space exhaustion from logs
GitHub Actions — Node.js CI Pipeline
Complete CI workflow for Node.js: install, lint, test, build on every push and PR with caching.
Best for: Automated testing on every push and PR
GitHub Actions — Deploy to Cloudflare Pages
Automated deployment pipeline to Cloudflare Pages with build preview for PRs and production on main.
Best for: Zero-config deployment for static Next.js exports