ssh-agentd-control

管理并使用本地 ssh-agentd(systemd 常驻 + API 调用 + 连通性验证)。当用户提到 ssh-agentd、持久 SSH 会话、/run /upload /tail_logs、开机自启、会话状态/指标排查时使用。

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "ssh-agentd-control" with this command: npx skills add offlinecat-dev/ssh-agentd-control

ssh-agentd 控制技能

适用环境(当前):

  • 二进制:/home/krex/.openclaw/workspace-hermes/ssh-agentd/bin/ssh-agentd
  • 配置:/home/krex/.openclaw/ssh-agentd/hosts.yaml
  • systemd:ssh-agentd.service
  • 默认监听:127.0.0.1:18081

快速检查

sudo systemctl is-enabled ssh-agentd.service
sudo systemctl is-active ssh-agentd.service
ss -ltnp | grep 18081
sudo systemctl status ssh-agentd.service --no-pager -l | sed -n '1,80p'

启停与自启

sudo systemctl daemon-reload
sudo systemctl enable --now ssh-agentd.service
sudo systemctl restart ssh-agentd.service
sudo systemctl stop ssh-agentd.service

API 调用要点

  1. 默认使用 Bearer Token 鉴权(若配置启用)
  2. 本机常有代理变量,调用本地 API 时必须绕过代理

推荐统一用脚本:scripts/api.sh

示例:运行远程命令

SSH_AGENTD_TOKEN='<token>' \
  scripts/api.sh POST /run '{"host":"nas","cmd":"hostname && whoami","timeoutSec":10}'

示例:查看会话与指标

SSH_AGENTD_TOKEN='<token>' scripts/api.sh GET /sessions
SSH_AGENTD_TOKEN='<token>' scripts/api.sh GET /metrics
SSH_AGENTD_TOKEN='<token>' scripts/api.sh GET /health

常见故障

1) 返回 401 unauthorized

  • 检查 apiAuth.enabled/token 配置
  • 确认请求头 Authorization: Bearer <token>

2) 调本地 API 返回 502

  • 原因:请求被系统代理劫持
  • 处理:用 --noproxy '*' 或临时 unset 代理变量(脚本已内置)

3) run 失败且提示 host key/known_hosts

  • 原因:v1 已启用 HostKey 校验
  • 处理:把目标主机 key 加入 known_hosts

安全约束

  • 不要把真实 token/密码写进 skill 文件。
  • 不要把 hosts.yaml 放进仓库。
  • 修改服务配置后必须重启并验证 status + /health + /sessions

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

Ai Automation Consulting

AI 自动化咨询服务 - 帮你用 AI 省时省钱。适合:中小企业、自由职业者、想提效的人。

Registry SourceRecently Updated
Automation

myskill

Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express...

Registry SourceRecently Updated
Automation

GridClash

Battle in Grid Clash - join 8-agent grid battles. Fetch equipment data to choose the best weapon, armor, and tier. Use when user wants to participate in Grid...

Registry SourceRecently Updated