Back to services

ttyd

Share your terminal over the web

View alternatives to ttyd
Suggest edit
Open source
Self-hostable
MIT
Recent reviews

Alternatives

Tech stack

No tech stack added yet. Sign in to suggest some

Note: The official website could not be fetched this time. The text below is based on existing knowledge of the project, so please refer to the official website and the GitHub repository for exact parameters and installation methods.

Introduction

ttyd is an open-source command-line tool for sharing a terminal over the web. It runs a shell or another command-line program on the server and forwards input and output to the browser over WebSocket. The front end renders the terminal with xterm.js, so users don't need to install an SSH client. They can use the command line just by opening a browser.

Key Features

  • Web-based terminal: The front end uses xterm.js and supports CJK characters and input methods.
  • High performance and small size: Written in C and built on libuv and libwebsockets, it has a low resource footprint.
  • File transfer: Supports the ZMODEM (with lrzsz) and trzsz protocols, so you can upload and download files in the browser.
  • Image display: Supports Sixel image output.
  • Security options: Supports SSL/TLS encryption and HTTP basic authentication.
  • Read-only or writable mode: Newer versions are read-only by default, and you need to add the -W option to allow client input.
  • Runs any command: It can run not only bash but any terminal program, such as top, htop, and vim.
  • Cross-platform: Supports platforms including Linux, macOS, FreeBSD, OpenWrt, and Windows.

Target Users and Use Cases

  • Ops engineers and developers who need temporary browser access to a server
  • Providing a web-based management terminal on NAS devices, routers (OpenWrt), or embedded devices
  • Sharing a terminal screen during teaching demos
  • Wrapping command-line tools as web services

Installation and Usage

  • macOS: brew install ttyd
  • Linux: Use your distribution's package, or download a prebuilt static binary from GitHub Releases
  • Docker: Use the official image tsl0922/ttyd
  • You can also build from source, which requires dependencies such as CMake, libwebsockets, libuv, and json-c

Basic usage examples:

# 在默认端口 7681 共享 bash,并允许客户端输入
ttyd -W bash

# 指定端口,并启用用户名和密码认证
ttyd -p 8080 -c user:password -W bash

After it starts, open http://server-address:port in a browser to access it.

Notes

Exposing a writable shell to the network is risky. We recommend enabling authentication and SSL, or using it behind a reverse proxy or VPN. The project is open source under the MIT license.