ttyd: one C binary that serves any command as a browser terminal on port 7681
Share your terminal over the web
At a glance
- What is it?
- ttyd is an MIT-licensed C tool that runs a command and exposes it as a terminal in the browser, built on libuv and WebGL2 with ZMODEM, trzsz and Sixel support. It is small and easy to deploy, but its built-in access control is a single basic-auth credential, and the newest tagged release is 1.7.7 from March 2024.
- Who is it for?
- ttyd is the right tool when you need a browser terminal for a single command on a machine you control, especially on small devices like OpenWrt routers or inside a container, and you can put it behind a reverse proxy or an interface you trust. It is the wrong tool if you need per-user accounts or fine-grained access control out of the box, since its built-in options stop at one username:password pair and an auth-proxy header.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 2 days ago.
- What is it written in?
- Mainly C, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 25, 2026, and from our analysis. They are not legal advice.
Star history
- tsl0922/ttyd12,681 ★ · +207
| Repository | 2026-10-07 | 2026-11-25 |
|---|---|---|
| tsl0922/ttyd | 12.5k | 12.7k |
207 Stars in the last 49 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
Any command becomes a browser terminal on port 7681
ttyd does one job: it starts a command and serves that command's terminal over the web. The usage line is the whole model:
ttyd [options] <command> [<arguments...>]The command can be a shell, but it does not have to be. ttyd runs any custom command with options, so you can expose a single program, a REPL or a login prompt rather than a full shell.
By default it listens on port 7681. The `-p, --port` option changes that, and passing `0` asks for a random port. In the browser, the terminal is built on xterm.js, so browser support follows xterm.js's own list, and ttyd needs a modern browser.
The consequence of this design is that whoever reaches the port gets the command you started, running as the user who launched ttyd. If that command is bash, a visitor has a shell. Everything else in a ttyd deployment, from interface binding to authentication, exists to control who reaches that port.
Binding to one interface or a UNIX domain socket
ttyd's `-i, --interface` option takes either a network interface name, such as eth0, or a UNIX domain socket path, such as /var/run/ttyd.sock. When a socket is used, `-U, --socket-owner` sets the user and group that own the socket file, in the form user:group.
These two options are the main way to keep ttyd off the open network. Binding to a single interface limits which network can reach the terminal. Binding to a UNIX domain socket takes ttyd off TCP entirely, so only local processes that can open the socket, such as a reverse proxy on the same machine, can talk to it. Setting the socket owner then decides which local user that proxy must run as.
If you skip both, ttyd listens on its port without these restrictions, and anything that can route to the machine can try to connect. On a laptop on a shared network or a router, that is exactly the exposure to avoid, so choose a binding before the first run rather than after.
Built-in authentication stops at one username:password pair
ttyd has two authentication options. `-c, --credential` enables HTTP basic authentication with a single credential in the format username:password. `-H, --auth-header` takes an HTTP header name and configures ttyd to let a reverse proxy handle authentication instead, trusting the identity the proxy passes in that header.
That is the full picture on the command line. There is one credential, not a user list, and there is no built-in notion of separate permissions per user. Everyone who knows the password gets the same command with the same rights. Basic authentication also sends credentials with every request, so ttyd's SSL support, based on OpenSSL or Mbed TLS, matters if you rely on `-c` across a network.
For anything beyond a shared password, the intended route is `-H`: put an authenticating reverse proxy in front, have it set the header, and bind ttyd where only the proxy can reach it. If the proxy is misconfigured and ttyd is reachable directly, the header check is only as strong as the network path.
The Docker image runs bash as root behind tini
ttyd publishes a Docker image, tsl0922/ttyd on Docker Hub, and the repository carries both a Dockerfile and a Dockerfile.alpine. The main Dockerfile is short:
FROM ubuntu:24.04
EXPOSE 7681
WORKDIR /root
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["ttyd", "-W", "bash"]It starts from Ubuntu 24.04, installs tini, copies a prebuilt ttyd binary for the target architecture from dist/, exposes port 7681 and works in /root. tini is the entrypoint, so it runs as PID 1 and starts ttyd.
Two details deserve attention before you publish that port. The Dockerfile sets no USER, so the default command runs bash as root inside the container. And the default command passes `-W`, a flag that does not appear in the short option list on the front page; check the man page in the man/ directory for its meaning. The default command also sets no credential, so running the image with port 7681 published gives anyone who reaches it a root shell in the container. Override the command with `-c` or put a proxy in front.
File transfer and images ride on lrzsz, trzsz and Sixel
ttyd's browser terminal goes beyond plain text. It is built on libuv on the server side and WebGL2 in the browser, and it handles CJK characters and IME input, which matters for users typing Chinese, Japanese or Korean into a remote shell.
File transfer works through the terminal stream rather than a separate upload page. ttyd supports ZMODEM through lrzsz and also supports trzsz. That means the transfer tools run inside the session: the remote side needs lrzsz or trzsz available for those transfers to start.
Images are handled through Sixel output, so tools like img2sixel from libsixel or lsix can draw pictures directly in the browser terminal.
The practical limit is that all of these depend on what the remote command can do. ttyd provides the terminal; if the container or router you are connected to does not have lrzsz, trzsz or img2sixel installed, the features are present in the browser but nothing on the other end uses them.
Packages exist for almost every platform, at different versions
ttyd runs on macOS, Linux, FreeBSD and OpenBSD, OpenWrt and Windows, and nearly every platform has a package:
brew install ttyd
sudo port install ttyd
sudo apt install ttyd
sudo snap install ttyd --classic
opkg install ttyd
winget install tsl0922.ttyd
scoop install ttydHomebrew covers both macOS and Linux. MacPorts is the other macOS route. On Linux, Debian and Ubuntu use apt, the snap installs with classic confinement, and OpenWrt uses opkg. Gentoo users clone an overlay hosted on Bitbucket and set it up as a local repository. Precompiled static binaries for Linux and the recommended Windows binary come from the GitHub releases page, and there is a Compile on Windows page in the wiki.
Each of these is maintained by a different packager, which is why the README carries a Repology badge tracking ttyd versions across repositories. A distro package can sit behind 1.7.7. If you need the newest tagged version, the static binaries from GitHub releases are the direct route.
The last tagged release is 1.7.7 from March 2024
ttyd's release history clusters tightly: 1.7.5 on 27 March 2024, 1.7.6 on 29 March 2024 and 1.7.7 on 30 March 2024. No newer tag follows those. The repository itself has seen later activity, with the last push on 12 August 2026.
The consequence is a gap between the code on main and what packages ship. Fixes committed after March 2024 reach users only if they build from source, using the CMakeLists.txt and cmake/ directory at the root, or if a packager picks up an untagged snapshot. If you hit a bug, check whether it is already fixed on main before assuming a package update will bring it.
ttyd's README names two alternatives. Wetty is a Node-based web terminal built around SSH and login. GoTTY is a Go-based web terminal. ttyd's own position next to them is a small C binary with libuv, broad packaging down to OpenWrt, and a Windows build, which makes it the option to reach for on constrained devices.
Editorial conclusion
ttyd is the right tool when you need a browser terminal for a single command on a machine you control, especially on small devices like OpenWrt routers or inside a container, and you can put it behind a reverse proxy or an interface you trust. It is the wrong tool if you need per-user accounts or fine-grained access control out of the box, since its built-in options stop at one username:password pair and an auth-proxy header. Before deploying, decide which interface ttyd binds to, check what the Docker image's -W flag does in the man page, and note that the latest tagged release is 1.7.7 from 30 March 2024.
Frequently asked questions
What is ttyd?
ttyd is a simple command-line tool, written in C and licensed under MIT, for sharing a terminal over the web. It runs a command you choose and serves its terminal in the browser, on port 7681 by default.
How does ttyd compare with Wetty and GoTTY?
ttyd names both as alternatives: Wetty is a Node-based web terminal for SSH and login, and GoTTY is a Go-based web terminal. ttyd itself is a C tool built on libuv and WebGL2.
How do I install ttyd on Windows?
The recommended way is the binary from the ttyd GitHub releases page. You can also use winget install tsl0922.ttyd or scoop install ttyd, or compile it following the Compile on Windows wiki page.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/tsl0922-ttyd)Star history chart for your README
[](https://hysenlabs.com/projects/tsl0922-ttyd)Was this useful?