ttyd
Share terminal sessions over the web
TLDR
Share a bash shell over the web
SYNOPSIS
ttyd [options] command [arguments...]
DESCRIPTION
ttyd shares a terminal session over the web using WebSockets. It starts a web server (default port 7681) that serves a terminal interface accessible from any web browser. This enables remote terminal access, collaboration, and demonstrations without requiring SSH setup.
Any command can be shared, not just shells. Running ttyd vim provides a web-based vim editor. Combining with tmux allows multiple users to share the same session simultaneously.
The tool supports basic authentication via -c, SSL encryption for secure connections, and can restrict clients to read-only mode. It handles Unicode, CJK characters, and supports file transfer via ZMODEM.
ttyd works on Linux, macOS, FreeBSD, OpenBSD, and Windows.
PARAMETERS
-p, --port port
Port to listen on (default: 7681, use 0 for random)-i, --interface interface
Network interface to bind (e.g., eth0) or Unix socket path-c, --credential user:pass
Basic authentication credentials-u, --uid uid
User ID to run command with-g, --gid gid
Group ID to run command with-R, --readonly
Do not allow clients to write to the TTY-W, --writable
Allow clients to write (readonly by default with multiple clients)-s, --signal signal
Signal to send on exit (default: 1, SIGHUP)--ssl
Enable SSL/TLS encryption--ssl-cert file
SSL certificate file path--ssl-key file
SSL key file path-O, --once
Accept only one client and exit when disconnected-d, --debug level
Set log level (0-9, default: 7)
CAVEATS
By default, ttyd provides no authentication; always use -c or firewall rules in production. Multiple clients connecting without tmux each get separate sessions. The default port 7681 may need firewall configuration for external access.
HISTORY
ttyd was created by Shuanglei Tao (tsl0922) and first released around 2016. Written in C, it uses libwebsockets for WebSocket communication and xterm.js for the browser-based terminal. The project was inspired by older tools like shellinabox but with modern web technologies.
