{
  "schemaVersion": "1.0",
  "item": {
    "slug": "rssh2",
    "name": "Rssh2 - SSH远程自动化工具",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/YKaiXu/rssh2",
    "canonicalUrl": "https://clawhub.ai/YKaiXu/rssh2",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/rssh2",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=rssh2",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md",
      "index.js",
      "package-lock.json",
      "package.json",
      "session-manager.js",
      "sftp-manager.js"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-07T17:22:31.273Z",
      "expiresAt": "2026-05-14T17:22:31.273Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=afrexai-annual-report",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=afrexai-annual-report",
        "contentDisposition": "attachment; filename=\"afrexai-annual-report-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/rssh2"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/rssh2",
    "agentPageUrl": "https://openagent3.xyz/skills/rssh2/agent",
    "manifestUrl": "https://openagent3.xyz/skills/rssh2/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/rssh2/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Rssh2 - SSH远程自动化工具",
        "body": "基于 ssh2 的 SSH 远程自动化工具，提供会话管理、隧道管理、文件传输等功能。"
      },
      {
        "title": "⚠️ 安全提示",
        "body": "重要： 请勿在代码中硬编码敏感信息（密码、私钥内容等）。建议：\n\n使用环境变量存储敏感配置\n使用密钥文件路径而非密钥内容\n将 test.js 中的配置替换为实际配置后再运行"
      },
      {
        "title": "🔐 会话管理",
        "body": "连接池管理（复用连接，提升性能）\n自动重连机制\n心跳保持\n命令队列\n并发控制"
      },
      {
        "title": "🌉 隧道管理",
        "body": "本地端口转发\n远程端口转发\n动态端口转发（SOCKS代理）\n多隧道管理\n自动重连"
      },
      {
        "title": "📁 文件传输",
        "body": "SFTP 上传/下载\n目录同步\n文件监控\n断点续传"
      },
      {
        "title": "⚙️ 配置管理",
        "body": "多主机配置\n密钥管理\n环境变量支持\n配置文件热加载"
      },
      {
        "title": "基本连接",
        "body": "const { Rssh2 } = require('./index.js');\n\nconst rssh2 = new Rssh2({\n  host: 'bg.dlna.net',\n  port: 38022,\n  username: 'root',\n  privateKey: '/home/yupeng/.ssh/id_ed25519'\n});\n\n// 执行命令\nconst result = await rssh2.exec('uptime');\nconsole.log(result.output);"
      },
      {
        "title": "会话管理",
        "body": "// 创建会话管理器\nconst sessionManager = rssh2.getSessionManager();\n\n// 执行多个命令（复用连接）\nconst results = await Promise.all([\n  sessionManager.exec('uptime'),\n  sessionManager.exec('df -h'),\n  sessionManager.exec('free -m')\n]);\n\n// 关闭会话\nawait sessionManager.close();"
      },
      {
        "title": "隧道管理",
        "body": "// 本地端口转发\nconst tunnel = await rssh2.tunnel.local({\n  localPort: 8080,\n  remoteHost: 'localhost',\n  remotePort: 80\n});\n\nconsole.log('隧道已建立: localhost:8080 -> remote:80');\n\n// 关闭隧道\nawait tunnel.close();"
      },
      {
        "title": "文件传输",
        "body": "// 上传文件\nawait rssh2.sftp.upload('./local.txt', '/remote/path/file.txt');\n\n// 下载文件\nawait rssh2.sftp.download('/remote/path/file.txt', './local.txt');\n\n// 同步目录\nawait rssh2.sftp.sync('./local-dir', '/remote/dir');"
      },
      {
        "title": "连接配置",
        "body": "{\n  host: 'example.com',        // 主机地址\n  port: 22,                   // SSH端口\n  username: 'user',           // 用户名\n  password: 'pass',           // 密码（可选）\n  privateKey: '/path/to/key', // 私钥路径（可选）\n  passphrase: 'keypass',      // 私钥密码（可选）\n  timeout: 10000,             // 连接超时（毫秒）\n  keepaliveInterval: 30000    // 心跳间隔（毫秒）\n}"
      },
      {
        "title": "会话管理器配置",
        "body": "{\n  maxPoolSize: 5,             // 最大连接池大小\n  maxConcurrent: 10,          // 最大并发命令数\n  commandTimeout: 30000,      // 命令超时（毫秒）\n  retryAttempts: 3,           // 重试次数\n  retryDelay: 1000            // 重试延迟（毫秒）\n}"
      },
      {
        "title": "隧道配置",
        "body": "{\n  localPort: 8080,            // 本地端口\n  remoteHost: 'localhost',    // 远程主机\n  remotePort: 80,             // 远程端口\n  autoReconnect: true,        // 自动重连\n  reconnectDelay: 5000        // 重连延迟（毫秒）\n}"
      },
      {
        "title": "Rssh2 主类",
        "body": "constructor(config)\n\n创建 Rssh2 实例\n\nexec(command, options?)\n\n执行单个命令\n\ngetSessionManager()\n\n获取会话管理器实例\n\ngetTunnelManager()\n\n获取隧道管理器实例\n\ngetSftpManager()\n\n获取 SFTP 管理器实例\n\nconnect()\n\n建立连接\n\ndisconnect()\n\n断开连接"
      },
      {
        "title": "SessionManager",
        "body": "exec(command, options?)\n\n执行命令（使用连接池）\n\nexecMultiple(commands)\n\n执行多个命令\n\nclose()\n\n关闭所有连接"
      },
      {
        "title": "TunnelManager",
        "body": "local(config)\n\n创建本地端口转发\n\nremote(config)\n\n创建远程端口转发\n\ndynamic(config)\n\n创建动态端口转发（SOCKS）\n\ncloseAll()\n\n关闭所有隧道"
      },
      {
        "title": "SftpManager",
        "body": "upload(localPath, remotePath)\n\n上传文件\n\ndownload(remotePath, localPath)\n\n下载文件\n\nsync(localDir, remoteDir)\n\n同步目录\n\nlist(path)\n\n列出文件\n\ndelete(path)\n\n删除文件"
      },
      {
        "title": "1. 远程运维",
        "body": "const rssh2 = new Rssh2(config);\n\n// 检查服务状态\nconst status = await rssh2.exec('systemctl status nginx');\n\n// 重启服务\nawait rssh2.exec('systemctl restart nginx');\n\n// 查看日志\nconst logs = await rssh2.exec('tail -n 100 /var/log/nginx/access.log');"
      },
      {
        "title": "2. 数据库隧道",
        "body": "// 创建数据库隧道\nconst tunnel = await rssh2.tunnel.local({\n  localPort: 3306,\n  remoteHost: 'localhost',\n  remotePort: 3306\n});\n\n// 现在可以通过 localhost:3306 访问远程数据库"
      },
      {
        "title": "3. 文件部署",
        "body": "// 上传应用文件\nawait rssh2.sftp.upload('./app.zip', '/tmp/app.zip');\n\n// 解压\nawait rssh2.exec('cd /var/www && unzip -o /tmp/app.zip');\n\n// 重启服务\nawait rssh2.exec('systemctl restart app');"
      },
      {
        "title": "4. 批量操作",
        "body": "const session = rssh2.getSessionManager();\n\n// 并发执行多个命令\nconst results = await session.execMultiple([\n  'uptime',\n  'df -h',\n  'free -m',\n  'ps aux | head -20'\n]);\n\nconsole.log(results);"
      },
      {
        "title": "安全建议",
        "body": "使用密钥认证 - 比密码更安全\n限制用户权限 - 不要使用 root 账号\n启用防火墙 - 限制 SSH 访问\n定期更新密钥 - 轮换 SSH 密钥\n日志审计 - 记录所有操作"
      },
      {
        "title": "连接失败",
        "body": "try {\n  await rssh2.connect();\n} catch (error) {\n  console.error('连接失败:', error.message);\n  // 检查主机、端口、认证信息\n}"
      },
      {
        "title": "命令超时",
        "body": "const result = await rssh2.exec('long-running-command', {\n  timeout: 60000  // 60秒超时\n});"
      },
      {
        "title": "隧道断开",
        "body": "const tunnel = await rssh2.tunnel.local(config, {\n  autoReconnect: true,\n  reconnectDelay: 5000\n});"
      },
      {
        "title": "依赖",
        "body": "ssh2 ^1.17.0"
      },
      {
        "title": "许可证",
        "body": "MIT"
      }
    ],
    "body": "Rssh2 - SSH远程自动化工具\n\n基于 ssh2 的 SSH 远程自动化工具，提供会话管理、隧道管理、文件传输等功能。\n\n⚠️ 安全提示\n\n重要： 请勿在代码中硬编码敏感信息（密码、私钥内容等）。建议：\n\n使用环境变量存储敏感配置\n使用密钥文件路径而非密钥内容\n将 test.js 中的配置替换为实际配置后再运行\n功能特性\n🔐 会话管理\n连接池管理（复用连接，提升性能）\n自动重连机制\n心跳保持\n命令队列\n并发控制\n🌉 隧道管理\n本地端口转发\n远程端口转发\n动态端口转发（SOCKS代理）\n多隧道管理\n自动重连\n📁 文件传输\nSFTP 上传/下载\n目录同步\n文件监控\n断点续传\n⚙️ 配置管理\n多主机配置\n密钥管理\n环境变量支持\n配置文件热加载\n快速开始\n基本连接\nconst { Rssh2 } = require('./index.js');\n\nconst rssh2 = new Rssh2({\n  host: 'bg.dlna.net',\n  port: 38022,\n  username: 'root',\n  privateKey: '/home/yupeng/.ssh/id_ed25519'\n});\n\n// 执行命令\nconst result = await rssh2.exec('uptime');\nconsole.log(result.output);\n\n会话管理\n// 创建会话管理器\nconst sessionManager = rssh2.getSessionManager();\n\n// 执行多个命令（复用连接）\nconst results = await Promise.all([\n  sessionManager.exec('uptime'),\n  sessionManager.exec('df -h'),\n  sessionManager.exec('free -m')\n]);\n\n// 关闭会话\nawait sessionManager.close();\n\n隧道管理\n// 本地端口转发\nconst tunnel = await rssh2.tunnel.local({\n  localPort: 8080,\n  remoteHost: 'localhost',\n  remotePort: 80\n});\n\nconsole.log('隧道已建立: localhost:8080 -> remote:80');\n\n// 关闭隧道\nawait tunnel.close();\n\n文件传输\n// 上传文件\nawait rssh2.sftp.upload('./local.txt', '/remote/path/file.txt');\n\n// 下载文件\nawait rssh2.sftp.download('/remote/path/file.txt', './local.txt');\n\n// 同步目录\nawait rssh2.sftp.sync('./local-dir', '/remote/dir');\n\n配置选项\n连接配置\n{\n  host: 'example.com',        // 主机地址\n  port: 22,                   // SSH端口\n  username: 'user',           // 用户名\n  password: 'pass',           // 密码（可选）\n  privateKey: '/path/to/key', // 私钥路径（可选）\n  passphrase: 'keypass',      // 私钥密码（可选）\n  timeout: 10000,             // 连接超时（毫秒）\n  keepaliveInterval: 30000    // 心跳间隔（毫秒）\n}\n\n会话管理器配置\n{\n  maxPoolSize: 5,             // 最大连接池大小\n  maxConcurrent: 10,          // 最大并发命令数\n  commandTimeout: 30000,      // 命令超时（毫秒）\n  retryAttempts: 3,           // 重试次数\n  retryDelay: 1000            // 重试延迟（毫秒）\n}\n\n隧道配置\n{\n  localPort: 8080,            // 本地端口\n  remoteHost: 'localhost',    // 远程主机\n  remotePort: 80,             // 远程端口\n  autoReconnect: true,        // 自动重连\n  reconnectDelay: 5000        // 重连延迟（毫秒）\n}\n\nAPI 参考\nRssh2 主类\nconstructor(config)\n\n创建 Rssh2 实例\n\nexec(command, options?)\n\n执行单个命令\n\ngetSessionManager()\n\n获取会话管理器实例\n\ngetTunnelManager()\n\n获取隧道管理器实例\n\ngetSftpManager()\n\n获取 SFTP 管理器实例\n\nconnect()\n\n建立连接\n\ndisconnect()\n\n断开连接\n\nSessionManager\nexec(command, options?)\n\n执行命令（使用连接池）\n\nexecMultiple(commands)\n\n执行多个命令\n\nclose()\n\n关闭所有连接\n\nTunnelManager\nlocal(config)\n\n创建本地端口转发\n\nremote(config)\n\n创建远程端口转发\n\ndynamic(config)\n\n创建动态端口转发（SOCKS）\n\ncloseAll()\n\n关闭所有隧道\n\nSftpManager\nupload(localPath, remotePath)\n\n上传文件\n\ndownload(remotePath, localPath)\n\n下载文件\n\nsync(localDir, remoteDir)\n\n同步目录\n\nlist(path)\n\n列出文件\n\ndelete(path)\n\n删除文件\n\n使用场景\n1. 远程运维\nconst rssh2 = new Rssh2(config);\n\n// 检查服务状态\nconst status = await rssh2.exec('systemctl status nginx');\n\n// 重启服务\nawait rssh2.exec('systemctl restart nginx');\n\n// 查看日志\nconst logs = await rssh2.exec('tail -n 100 /var/log/nginx/access.log');\n\n2. 数据库隧道\n// 创建数据库隧道\nconst tunnel = await rssh2.tunnel.local({\n  localPort: 3306,\n  remoteHost: 'localhost',\n  remotePort: 3306\n});\n\n// 现在可以通过 localhost:3306 访问远程数据库\n\n3. 文件部署\n// 上传应用文件\nawait rssh2.sftp.upload('./app.zip', '/tmp/app.zip');\n\n// 解压\nawait rssh2.exec('cd /var/www && unzip -o /tmp/app.zip');\n\n// 重启服务\nawait rssh2.exec('systemctl restart app');\n\n4. 批量操作\nconst session = rssh2.getSessionManager();\n\n// 并发执行多个命令\nconst results = await session.execMultiple([\n  'uptime',\n  'df -h',\n  'free -m',\n  'ps aux | head -20'\n]);\n\nconsole.log(results);\n\n安全建议\n使用密钥认证 - 比密码更安全\n限制用户权限 - 不要使用 root 账号\n启用防火墙 - 限制 SSH 访问\n定期更新密钥 - 轮换 SSH 密钥\n日志审计 - 记录所有操作\n故障排查\n连接失败\ntry {\n  await rssh2.connect();\n} catch (error) {\n  console.error('连接失败:', error.message);\n  // 检查主机、端口、认证信息\n}\n\n命令超时\nconst result = await rssh2.exec('long-running-command', {\n  timeout: 60000  // 60秒超时\n});\n\n隧道断开\nconst tunnel = await rssh2.tunnel.local(config, {\n  autoReconnect: true,\n  reconnectDelay: 5000\n});\n\n依赖\nssh2 ^1.17.0\n许可证\n\nMIT"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/YKaiXu/rssh2",
    "publisherUrl": "https://clawhub.ai/YKaiXu/rssh2",
    "owner": "YKaiXu",
    "version": "1.0.1",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/rssh2",
    "downloadUrl": "https://openagent3.xyz/downloads/rssh2",
    "agentUrl": "https://openagent3.xyz/skills/rssh2/agent",
    "manifestUrl": "https://openagent3.xyz/skills/rssh2/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/rssh2/agent.md"
  }
}