Knowledge Hubบทที่ 14
Updates · อัปเดตใหม่

maw ssh-share · collaborative web terminal

เรื่องใหม่จาก inbox review รอบ 3 ชั่วโมง จึงเพิ่มเป็น chapter ใหม่ท้ายเล่ม · This is a new inbox-reviewed topic, so it is appended as a new chapter rather than blended into older chapters.

Source and publishing rule

บทนี้มาจาก Discord #road-to-dev message 1514832639968809112 โดย SomBo เวลา 2026-06-12T03:24:05Z. ข้อความระบุว่าเป็นการบ้านจาก P'Nat เรื่อง maw ssh-share.

This update was discovered by the PM2 inbox-review job from Pien's bridge inbox, then verified by fetching the Discord message context before publishing.

กฎเดิมยังใช้เหมือนเดิม: เรื่องใหม่เพิ่ม chapter ใหม่ท้ายเล่ม ไม่ merge เข้า chapter เก่า.

What it is

maw ssh-share is a wrapper around the sshx collaborative terminal pattern: a shell session is exposed through a browser URL so multiple people can watch or interact in real time.

The reference deployment described in Discord is ssh.clubsxai.com, backed by an sshx-server on 127.0.0.1:8051 and published through a Cloudflare tunnel.

Architecture

[sshx CLI client]
      │  gRPC (crates/sshx-core proto)
      ▼
[sshx-server :8051]
      │  WebSocket at /api/s/<name>
      ▼           CBOR-encoded messages (cbor-x)
[Browser / xterm.js]
      ▲
      │  URL: /s/<hash>#<encryption-key>
      │  key stays in the URL hash, so the server does not see it

The browser side is an xterm.js terminal. The URL fragment carries the encryption key, which is the important security property: the server can route the session without receiving the key.

Protocol pieces

DirectionMessagesMeaning
Server → browserhello, shells, chunks, users, hearInitial handshake, terminal list, terminal data, presence, and chat/audio-style events.
Browser → serverauthenticate, data, subscribe, create, setName, chatAuth, terminal input, session subscription, shell creation, display name, and chat.
Transport helperSrocketAuto-reconnecting WebSocket wrapper using CBOR binary encoding.

maw commands

maw ssh-share start              # share bash
maw ssh-share start --shell zsh  # use another shell
maw ssh-share start --readonly   # create a read-only link
maw ssh-share status             # check server status

A successful start prints a browser share URL. Anyone with the URL can join the terminal from the browser; a read-only link should be used when observers do not need shell input.

Expected result

Session ready
Share URL: https://ssh.clubsxai.com/s/<session>#<key>

Anyone with the link can join the terminal in their browser.

Opening the URL shows a live multi-user terminal. Participants can see the terminal stream and user cursors in real time.

Local anchors

AnchorPath / endpointUse
Plugin~/.maw/plugins/ssh-share/maw plugin wrapper.
sshx source/root/Code/github.com/ekzhang/sshx/Reference implementation.
Server127.0.0.1:8051Local sshx-server endpoint behind tunnel.
Public tunnelssh.clubsxai.comBrowser-facing terminal share host.

Operating rules

Use read-only by default

Give write access only when the remote participant should type into the shell.

Protect the URL fragment

The key lives after #. Treat the full URL as sensitive capability access.

Prefer short sessions

Shared shells should be temporary. Close the session when the collaboration ends.

Check status first

Use maw ssh-share status before debugging clients or tunnels.