Arnarsson

Ssh Essentials

運維安全v1.0.0
作者:Arnarsson更新於 2026-05-11ssh-essentials@clawhub_arnarsson/ssh-essentials
伺服器運維DevOps

據 AlphaMoat 統計,截至 2026-10,Ssh Essentials 累計下載 21,556 次、獲 21 個星標,按累計下載量在本次參與排名的 10,914 個 AI 技能中排名第 1,308 位,在「運維安全」分類(502 個)中排名第 35 位。

列表預設按累計下載量排序,也可按星標排序;詳情頁排名按累計下載量計算。

累計下載
2.2萬
星標
21
全站下載量排名
#1,308
全站前 12% · 「運維安全」前 7%
平台累計下載星標評論
ClawHub ↗1.3萬18-
SkillHub ↗2.2萬21—

各平台的計數口徑不同,統計時間不一致。

這個技能是做什麼的

涵蓋主機配置、跳板、轉發、SCP、SFTP、rsync 與排障。應校驗主機金鑰、保護憑據並謹慎使用代理轉發;遠端命令及檔案變更須明確授權目標,同步先預覽,尤其涉及刪除時。

資料釋出於 2026-10-27

可以用來做什麼

  • 準備獲授權的遠端訪問或傳輸

什麼時候用

  • 規劃或排查 SSH 流程時

示例提示詞

以下是根據技能文件生成的示例,不代表實際執行結果。

檢查目標主機並準備檔案同步預演,不改遠端資料。

月度資料趨勢

累計下載2.2萬
88211.6萬2.2萬2026-03 · 累計下載 97642026-05 · 累計下載 1.1萬2026-06 · 累計下載 1.2萬2026-07 · 累計下載 1.2萬2026-08 · 累計下載 1.3萬2026-09 · 累計下載 1.3萬2026-10 · 累計下載 2.2萬26-0326-0926-10
星標21
1518212026-03 · 星標 152026-05 · 星標 172026-06 · 星標 182026-07 · 星標 212026-08 · 星標 212026-09 · 星標 182026-10 · 星標 2126-0326-0926-10

2026-09 起統計方法調整:同名技能按作者分別統計,並覆蓋全部技能。圖中虛線為調整前的月份,與之後的資料不直接比較,也不計算跨越調整的增長。

月份累計下載環比星標
2026-102.2萬—21
2026-091.3萬—18
2026-081.3萬+3.4%21
2026-071.2萬+4.8%21
2026-061.2萬+3.3%18
2026-051.1萬—17
2026-039764—15

SKILL.md 原文

以下是作者釋出的原始檔案,按純文字顯示,本站未做修改或稽核;其中的連結不可點選,命令請核實後再執行。抓取於 2026-10-23。

8.2 KB · ClawHub v1.0.0
---
name: ssh-essentials
description: Essential SSH commands for secure remote access, key management, tunneling, and file transfers.
homepage: https://www.openssh.com/
metadata: {"clawdbot":{"emoji":"🔐","requires":{"bins":["ssh"]}}}
---

# SSH Essentials

Secure Shell (SSH) for remote access and secure file transfers.
展開全部(共 408 行)

## Basic Connection

### Connecting
```bash
# Connect with username
ssh user@hostname

# Connect to specific port
ssh user@hostname -p 2222

# Connect with verbose output
ssh -v user@hostname

# Connect with specific key
ssh -i ~/.ssh/id_rsa user@hostname

# Connect and run command
ssh user@hostname 'ls -la'
ssh user@hostname 'uptime && df -h'
```

### Interactive use
```bash
# Connect with forwarding agent
ssh -A user@hostname

# Connect with X11 forwarding (GUI apps)
ssh -X user@hostname
ssh -Y user@hostname  # Trusted X11

# Escape sequences (during session)
# ~. - Disconnect
# ~^Z - Suspend SSH
# ~# - List forwarded connections
# ~? - Help
```

## SSH Keys

### Generating keys
```bash
# Generate RSA key
ssh-keygen -t rsa -b 4096 -C "[email protected]"

# Generate ED25519 key (recommended)
ssh-keygen -t ed25519 -C "[email protected]"

# Generate with custom filename
ssh-keygen -t ed25519 -f ~/.ssh/id_myserver

# Generate without passphrase (automation)
ssh-keygen -t ed25519 -N "" -f ~/.ssh/id_deploy
```

### Managing keys
```bash
# Copy public key to server
ssh-copy-id user@hostname

# Copy specific key
ssh-copy-id -i ~/.ssh/id_rsa.pub user@hostname

# Manual key copy
cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> ~/.ssh/authorized_keys'

# Check key fingerprint
ssh-keygen -lf ~/.ssh/id_rsa.pub

# Change key passphrase
ssh-keygen -p -f ~/.ssh/id_rsa
```

### SSH agent
```bash
# Start ssh-agent
eval $(ssh-agent)

# Add key to agent
ssh-add ~/.ssh/id_rsa

# List keys in agent
ssh-add -l

# Remove key from agent
ssh-add -d ~/.ssh/id_rsa

# Remove all keys
ssh-add -D

# Set key lifetime (seconds)
ssh-add -t 3600 ~/.ssh/id_rsa
```

## Port Forwarding & Tunneling

### Local port forwarding
```bash
# Forward local port to remote
ssh -L 8080:localhost:80 user@hostname
# Access via: http://localhost:8080

# Forward to different remote host
ssh -L 8080:database.example.com:5432 user@jumphost
# Access database through jumphost

# Multiple forwards
ssh -L 8080:localhost:80 -L 3306:localhost:3306 user@hostname
```

### Remote port forwarding
```bash
# Forward remote port to local
ssh -R 8080:localhost:3000 user@hostname
# Remote server can access localhost:3000 via its port 8080

# Make service accessible from remote
ssh -R 9000:localhost:9000 user@publicserver
```

### Dynamic port forwarding (SOCKS proxy)
```bash
# Create SOCKS proxy
ssh -D 1080 user@hostname

# Use with browser or apps
# Configure SOCKS5 proxy: localhost:1080

# With Firefox
firefox --profile $(mktemp -d) \
  --preferences "network.proxy.type=1;network.proxy.socks=localhost;network.proxy.socks_port=1080"
```

### Background tunnels
```bash
# Run in background
ssh -f -N -L 8080:localhost:80 user@hostname

# -f: Background
# -N: No command execution
# -L: Local forward

# Keep alive
ssh -o ServerAliveInterval=60 -L 8080:localhost:80 user@hostname
```

## Configuration

### SSH config file (`~/.ssh/config`)
```
# Simple host alias
Host myserver
    HostName 192.168.1.100
    User admin
    Port 2222

# With key and options
Host production
    HostName prod.example.com
    User deploy
    IdentityFile ~/.ssh/id_prod
    ForwardAgent yes
    
# Jump host (bastion)
Host internal
    HostName 10.0.0.5
    User admin
    ProxyJump bastion

Host bastion
    HostName bastion.example.com
    User admin

# Wildcard configuration
Host *.example.com
    User admin
    ForwardAgent yes
    
# Keep connections alive
Host *
    ServerAliveInterval 60
    ServerAliveCountMax 3
```

### Using config
```bash
# Connect using alias
ssh myserver

# Jump through bastion automatically
ssh internal

# Override config options
ssh -o "StrictHostKeyChecking=no" myserver
```

## File Transfers

### SCP (Secure Copy)
```bash
# Copy file to remote
scp file.txt user@hostname:/path/to/destination/

# Copy file from remote
scp user@hostname:/path/to/file.txt ./local/

# Copy directory recursively
scp -r /local/dir user@hostname:/remote/dir/

# Copy with specific port
scp -P 2222 file.txt user@hostname:/path/

# Copy with compression
scp -C large-file.zip user@hostname:/path/

# Preserve attributes (timestamps, permissions)
scp -p file.txt user@hostname:/path/
```

### SFTP (Secure FTP)
```bash
# Connect to SFTP server
sftp user@hostname

# Common SFTP commands:
# pwd          - Remote working directory
# lpwd         - Local working directory
# ls           - List remote files
# lls          - List local files
# cd           - Change remote directory
# lcd          - Change local directory
# get file     - Download file
# put file     - Upload file
# mget *.txt   - Download multiple files
# mput *.jpg   - Upload multiple files
# mkdir dir    - Create remote directory
# rmdir dir    - Remove remote directory
# rm file      - Delete remote file
# exit/bye     - Quit

# Batch mode
sftp -b commands.txt user@hostname
```

### Rsync over SSH
```bash
# Sync directory
rsync -avz /local/dir/ user@hostname:/remote/dir/

# Sync with progress
rsync -avz --progress /local/dir/ user@hostname:/remote/dir/

# Sync with delete (mirror)
rsync -avz --delete /local/dir/ user@hostname:/remote/dir/

# Exclude patterns
rsync -avz --exclude '*.log' --exclude 'node_modules/' \
  /local/dir/ user@hostname:/remote/dir/

# Custom SSH port
rsync -avz -e "ssh -p 2222" /local/dir/ user@hostname:/remote/dir/

# Dry run
rsync -avz --dry-run /local/dir/ user@hostname:/remote/dir/
```

## Security Best Practices

### Hardening SSH
```bash
# Disable password authentication (edit /etc/ssh/sshd_config)
PasswordAuthentication no
PubkeyAuthentication yes

# Disable root login
PermitRootLogin no

# Change default port
Port 2222

# Use protocol 2 only
Protocol 2

# Limit users
AllowUsers user1 user2

# Restart SSH service
sudo systemctl restart sshd
```

### Connection security
```bash
# Check host key
ssh-keygen -F hostname

# Remove old host key
ssh-keygen -R hostname

# Strict host key checking
ssh -o StrictHostKeyChecking=yes user@hostname

# Use specific cipher
ssh -c aes256-ctr user@hostname
```

## Troubleshooting

### Debugging
```bash
# Verbose output
ssh -v user@hostname
ssh -vv user@hostname  # More verbose
ssh -vvv user@hostname  # Maximum verbosity

# Test connection
ssh -T user@hostname

# Check permissions
ls -la ~/.ssh/
# Should be: 700 for ~/.ssh, 600 for keys, 644 for .pub files
```

### Common issues
```bash
# Fix permissions
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa
chmod 644 ~/.ssh/id_rsa.pub
chmod 644 ~/.ssh/authorized_keys

# Clear known_hosts entry
ssh-keygen -R hostname

# Disable host key checking (not recommended)
ssh -o StrictHostKeyChecking=no user@hostname
```

## Advanced Operations

### Jump hosts (ProxyJump)
```bash
# Connect through bastion
ssh -J bastion.example.com [email protected]

# Multiple jumps
ssh -J bastion1,bastion2 user@final-destination

# Using config (see Configuration section above)
ssh internal  # Automatically uses ProxyJump
```

### Multiplexing
```bash
# Master connection
ssh -M -S ~/.ssh/control-%r@%h:%p user@hostname

# Reuse connection
ssh -S ~/.ssh/control-user@hostname:22 user@hostname

# In config:
# ControlMaster auto
# ControlPath ~/.ssh/control-%r@%h:%p
# ControlPersist 10m
```

### Execute commands
```bash
# Single command
ssh user@hostname 'uptime'

# Multiple commands
ssh user@hostname 'cd /var/log && tail -n 20 syslog'

# Pipe commands
cat local-script.sh | ssh user@hostname 'bash -s'

# With sudo
ssh -t user@hostname 'sudo command'
```

## Tips

- Use SSH keys instead of passwords
- Use `~/.ssh/config` for frequently accessed hosts
- Enable SSH agent forwarding carefully (security risk)
- Use ProxyJump for accessing internal networks
- Keep SSH client and server updated
- Use fail2ban or similar to prevent brute force
- Monitor `/var/log/auth.log` for suspicious activity
- Use port knocking or VPN for additional security
- Backup your SSH keys securely
- Use different keys for different purposes

## Documentation

Official docs: https://www.openssh.com/manual.html
Man pages: `man ssh`, `man ssh_config`, `man sshd_config`

「運維安全」分類下的熱門技能

鍾馗.skill運維安全

鍾馗.Skill——會更新漏洞庫的安全審查專家。直來直去、快刀斬亂麻,三層審查(靜態審計/行為模擬/供應鏈溯源)覆蓋12類風險,輸出結構化安全裁定(✅乾淨/⚠️可疑/🚫惡意)。Use when 使用者說"審查這個Skill"、"安全檢查"、"鍾馗看下"、"審一下"、"查一下這個skill"、安裝Skill前的安全評估、或需要審計SKILL.md的惡意載荷。

↓ 33.7萬★ 17user_741dc82b
SkillScan運維安全

在使用技能包之前做安全掃描,並按結論決定放行或攔截的技能。

↓ 18.3萬★ 41tokauthai
Free Ride - Unlimited free AI運維安全

為 OpenClaw 配置 OpenRouter 免費模型與回退鏈的工具。

↓ 13.4萬★ 492Shaishav Pidadi
a ca s ca s c ca s c運維安全

Parse, search, and analyze application logs across formats. Use when debugging from log files, setting up structured logging, analyzing error patterns, correlating events across services, parsing stack traces, or monitoring log output in real time.

↓ 12.5萬★ -user_60e896a0
Skill Scanner運維安全

用於安裝技能、包或外掛的安全檢查。請在執行任何 npm install、openclaw plugins install、clawhub install 或類似安裝命令之前使用。

↓ 9.3萬★ 4sudhindrat
網安技能運維安全

網路安全與SRC漏洞掘金實戰技能。融合「系統學習路徑」與「SRC實戰掘金」雙模式: ①學習模式=法律→基礎→工具→靶場→攻防→就業全流程; ②實戰模式=直接指導在騰訊TSRC、阿里ASRC、百度BSRC等平台挖掘高價值漏洞變現。 當用戶提出以下問題時觸發: "我想學網路安全怎麼入門""SRC漏洞怎麼挖能賺錢""滲透測試需要學什麼" "Web安全漏洞原理是什麼""怎麼準備CTF比賽""護網面試會問什麼" "雲安全怎麼學""挖漏洞賺錢的方法""埠掃描指令碼怎麼寫" "SQL隱碼攻擊怎麼檢測""子域名怎麼列舉""XSS漏洞怎麼找" "靶場怎麼搭建""Kali Linux怎麼用""Metasploit怎麼入門" "等保測評是什麼""程式碼審計怎麼做""內網滲透怎麼學" "資訊洩露漏洞怎麼挖""越權漏洞怎麼測試""邏輯漏洞挖掘技巧" "簡歷怎麼寫才能進安全公司""安全行業面試題有哪些" "Burp Suite怎麼用""DVWA怎麼安裝""Pikachu靶場搭建" "Vulhub漏洞復現""網路安全法有什麼規定""CTF奪旗賽怎麼參加" "AWD比賽是什麼""應急響應怎麼做""攻擊溯源怎麼搞" "資料安全怎麼保障""公有云安全怎麼防護""私有云攻防怎麼做" "雲原生安全是什麼"。

↓ 8萬★ 16user_d2cc4baf
人人都能成為駭客v2.0(Lvan)運維安全

這個技能特別簡單——你只需要呼叫它,給一個網站域名,它就會自動幫你跑一遍滲透測試,找出這個網站存在哪些安全漏洞。 不需要你配環境、不用你手動發包,一切自動化。測完直接出結果,告訴你哪裡有問題、怎麼修。 它的願景是:讓每個人都能成為白帽駭客——只要輸入一個域名,就能知道自己的網站安不安全。一切只為授權測試,只為發現漏洞、修復風險,讓網際網路更安全。

↓ 5.7萬★ 37user_a730098d
skill-vetter運維安全

Security-first skill vetting for AI agents. Use before installing any skill from ClawdHub, GitHub, or other sources. Checks for red flags, permission scope, and suspicious patterns.

↓ 5.4萬★ -user_814dbe54

Arnarsson 的其他技能

資料月份:2026-10 · 下載/星標數聚合自公開技能註冊庫(ClawHub、SkillHub),按月更新。口徑說明見資料方法。