Files
note_sync/自建服务/sshwifty网页SSH终端.md

2.2 KiB
Raw Permalink Blame History

sshwifty 网页 SSH 终端

2026-08-13 记录。网页版通用 SSH 客户端,浏览器里填主机/端口/账号即可连接任意机器。Go 单二进制,内存占用 ~10–30MB。


docker-compose 服务

  sshwifty:
    image: niruix/sshwifty:latest
    container_name: sshwifty
    restart: unless-stopped
    environment:
      - SSHWIFTY_CONFIG=/etc/sshwifty.conf.json   # 指向配置文件
    volumes:
      - ./sshwifty.conf.json:/etc/sshwifty.conf.json

不暴露端口,由 Caddy 反代 sshwifty:8182(WebSocket,Caddy 默认支持),入口 https://ssh.hyonglin.top。


配置文件 sshwifty.conf.json(含预设主机)

{
  "SharedKey": "han",
  "Servers": [
    { "ListenInterface": "0.0.0.0", "ListenPort": 8182 }
  ],
  "Presets": [
    {
      "Title": "pc01",
      "Type": "SSH",
      "Host": "hyonglin.top:2201",
      "Meta": { "User": "ylhan", "Encoding": "utf-8", "Authentication": "Password" }
    },
    {
      "Title": "pc02",
      "Type": "SSH",
      "Host": "hyonglin.top:2202",
      "Meta": { "User": "ylhan", "Encoding": "utf-8", "Authentication": "Password" }
    },
    {
      "Title": "云服务器",
      "Type": "SSH",
      "Host": "hyonglin.top:22",
      "Meta": { "User": "ubuntu", "Encoding": "utf-8", "Authentication": "Password" }
    }
  ],
  "OnlyAllowPresetRemotes": false
}

端口写在 Host 里用 host:port,没有单独的 Port 字段。OnlyAllowPresetRemotes: true 可限制只连预设主机。改完配置 docker compose up -d sshwifty 重启生效。


使用

  1. 打开 https://ssh.hyonglin.top,输入 SharedKey 密码
  2. 预设主机点一下即连,也可手动填任意主机:
预设 目标
pc01 hyonglin.top:2201
pc02 hyonglin.top:2202
云服务器 hyonglin.top:22

坑:Known Remotes 不跨设备

Known Remotes(已知主机)存在浏览器 localStorage,换机器/换浏览器/清缓存都会丢,没有服务端存储。

要跨设备固定入口,就用上面的 Presets(服务端配置,所有机器通用)。


相关链接