ssh
SSH remote access patterns and utilities. Connect to servers, manage keys, tunnels, and transfers.
What this skill does
# SSH Skill
Use SSH for secure remote access, file transfers, and tunneling.
## Basic Connection
Connect to server:
```bash
ssh user@hostname
```
Connect on specific port:
```bash
ssh -p 2222 user@hostname
```
Connect with specific identity:
```bash
ssh -i ~/.ssh/my_key user@hostname
```
## SSH Config
Config file location:
```
~/.ssh/config
```
Example config entry:
```
Host myserver
HostName 192.168.1.100
User deploy
Port 22
IdentityFile ~/.ssh/myserver_key
ForwardAgent yes
```
Then connect with just:
```bash
ssh myserver
```
## Running Remote Commands
Execute single command:
```bash
ssh user@host "ls -la /var/log"
```
Execute multiple commands:
```bash
ssh user@host "cd /app && git pull && pm2 restart all"
```
Run with pseudo-terminal (for interactive):
```bash
ssh -t user@host "htop"
```
## File Transfer with SCP
Copy file to remote:
```bash
scp local.txt user@host:/remote/path/
```
Copy file from remote:
```bash
scp user@host:/remote/file.txt ./local/
```
Copy directory recursively:
```bash
scp -r ./local_dir user@host:/remote/path/
```
## File Transfer with rsync (preferred)
Sync directory to remote:
```bash
rsync -avz ./local/ user@host:/remote/path/
```
Sync from remote:
```bash
rsync -avz user@host:/remote/path/ ./local/
```
With progress and compression:
```bash
rsync -avzP ./local/ user@host:/remote/path/
```
Dry run first:
```bash
rsync -avzn ./local/ user@host:/remote/path/
```
## Port Forwarding (Tunnels)
Local forward (access remote service locally):
```bash
ssh -L 8080:localhost:80 user@host
# Now localhost:8080 connects to host's port 80
```
Local forward to another host:
```bash
ssh -L 5432:db-server:5432 user@jumphost
# Access db-server:5432 via localhost:5432
```
Remote forward (expose local service to remote):
```bash
ssh -R 9000:localhost:3000 user@host
# Remote's port 9000 connects to your local 3000
```
Dynamic SOCKS proxy:
```bash
ssh -D 1080 user@host
# Use localhost:1080 as SOCKS5 proxy
```
## Jump Hosts / Bastion
Connect through jump host:
```bash
ssh -J jumphost user@internal-server
```
Multiple jumps:
```bash
ssh -J jump1,jump2 user@internal-server
```
In config file:
```
Host internal
HostName 10.0.0.50
User deploy
ProxyJump bastion
```
## Key Management
Generate new key (Ed25519, recommended):
```bash
ssh-keygen -t ed25519 -C "[email protected]"
```
Generate RSA key (legacy compatibility):
```bash
ssh-keygen -t rsa -b 4096 -C "[email protected]"
```
Copy public key to server:
```bash
ssh-copy-id user@host
```
Copy specific key:
```bash
ssh-copy-id -i ~/.ssh/mykey.pub user@host
```
## SSH Agent
Start agent:
```bash
eval "$(ssh-agent -s)"
```
Add key to agent:
```bash
ssh-add ~/.ssh/id_ed25519
```
Add with macOS keychain:
```bash
ssh-add --apple-use-keychain ~/.ssh/id_ed25519
```
List loaded keys:
```bash
ssh-add -l
```
## Multiplexing (Connection Sharing)
In ~/.ssh/config:
```
Host *
ControlMaster auto
ControlPath ~/.ssh/sockets/%r@%h-%p
ControlPersist 600
```
Create socket directory:
```bash
mkdir -p ~/.ssh/sockets
```
## Known Hosts
Remove old host key:
```bash
ssh-keygen -R hostname
```
Scan and add host key:
```bash
ssh-keyscan hostname >> ~/.ssh/known_hosts
```
## Debugging
Verbose output:
```bash
ssh -v user@host
```
Very verbose:
```bash
ssh -vv user@host
```
Maximum verbosity:
```bash
ssh -vvv user@host
```
## Security Tips
- Use Ed25519 keys (faster, more secure than RSA)
- Set `PasswordAuthentication no` on servers
- Use `fail2ban` on servers to block brute force
- Keep keys encrypted with passphrases
- Use `ssh-agent` to avoid typing passphrase repeatedly
- Restrict key usage with `command=` in authorized_keys
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.