WebTMUX is a small, password-protected web terminal for persistent tmux
sessions. It uses Express for the HTTP API, Socket.IO for live terminal traffic,
node-pty for the pseudoterminal bridge, and xterm.js in the browser.
- Browser-based terminal connected to real
tmuxsessions. - Password login required before any terminal socket can connect.
- Session listing, creation, reconnection, and logout.
- Persistent shell state through
tmux new-session -A. - Docker image with Node.js and
tmuxincluded. - Basic hardening with Helmet, session cookies, and login rate limiting.
- Node.js 20 or newer.
tmuxavailable inPATHwhen running directly on the host.- A strong
WEBTMUX_PASSWORD.
This application exposes shell access through a browser. Do not run it on a public network without HTTPS, a strong password, and firewall rules that match your threat model.
npm install
WEBTMUX_PASSWORD=change-me npm startOpen http://127.0.0.1:3000 and sign in with the password from
WEBTMUX_PASSWORD.
Optional environment variables:
| Variable | Default | Purpose |
|---|---|---|
PORT |
3000 |
HTTP port. |
HOST |
0.0.0.0 |
HTTP bind address. |
WEBTMUX_PASSWORD |
required | Login password. |
WEBTMUX_SESSION_SECRET |
generated at boot | Cookie signing secret. Set this in production. |
WEBTMUX_DEFAULT_SESSION |
webtmux |
Session used when none exists yet. |
WEBTMUX_SECURE_COOKIES |
false |
Set to true when serving over HTTPS. |
docker compose up --buildEdit docker-compose.yml first and replace both WEBTMUX_PASSWORD and
WEBTMUX_SESSION_SECRET.
POST /api/loginwith{ "password": "..." }.POST /api/logout.GET /api/me.GET /api/sessions.POST /api/sessionswith{ "name": "dev" }.DELETE /api/sessions/:name.
Socket.IO events:
- Client sends
terminal:startwith{ sessionName, cols, rows }. - Client sends
terminal:datafor keystrokes. - Client sends
terminal:resizewith{ cols, rows }. - Server emits
terminal:data,terminal:ready,terminal:error, andterminal:exit.
The current implementation is an MVP suitable for a v0.1.0 tag. Good next
steps are HTTPS/reverse-proxy documentation, clipboard controls, attach-only
mode, and automated tests for auth/session behavior.