ttyd

tsl0922MIT活跃维护

把命令行终端通过 WebSocket 搬到浏览器里,用 C 写的轻量服务,一条命令就能远程共享终端,适合做网页版运维面板或设备调试入口。

Share your terminal over the web

1.7.7发布于 2024-03-30 03:18 UTC12,604star +10 / 7 天1,230fork同步于 2026-11-10 11:28 UTC

怎么上手

由 README 提炼,执行前请确认
brew install ttyd
sudo apt install ttyd
硬件要求按 README 说明

README 未说明硬件要求,仅列出支持 macOS、Linux、FreeBSD/OpenBSD、OpenWrt、Windows 等平台

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

把本机终端通过浏览器分享出去的命令行工具,一条命令即可远程访问

把命令行终端通过 WebSocket 搬到浏览器里,用 C 写的轻量服务,一条命令就能远程共享终端,适合做网页版运维面板或设备调试入口。

核心能力

  • 基于 libuv 和 WebGL2 实现快速渲染
  • 完整终端体验,支持 CJK 字符与输入法
  • 支持 ZMODEM/trzsz 文件传输与 Sixel 图片输出
  • 内置 Basic 认证与基于 OpenSSL/Mbed TLS 的 SSL
  • 可指定任意自定义命令并跨 macOS/Linux/Windows 运行

容易踩的坑

默认监听端口为 7681,且默认只读,需加 -W 才允许客户端写入;URL 传参需显式开启 -a;反向代理场景需用 -b 指定 base path。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本1.7.7
  1. 1.7.7最新正式版2024-03-30 · 2024-03-30 03:18 UTC

    This release fixes version detection when not building from git repo (#1339), you don't need to update if you don't mind it.

    Changelog

    • Bump to 1.7.7 (40e79c706be14029b391f369bee6613c31667abb)
    • cmake: add static version back (62f44f827a4f21c7601b56d109acc2b96a8cd16b)

    The release action now checks the version bump, it will fail if I forget to bump version in CMakeLists.txt.

  2. 1.7.62024-03-29 · 2024-03-29 01:41 UTC
    查看更新说明

    This release fixes that 1.7.5 reports incorrect version (#1337), you don't need to update if you don't mind it.

    [!Note] Support for cmake < 3.12.0 is dropped in this release.

    Changelog

    • workflow: update actions packages (#1316) (89fb69b4806a30143ffecd18738df7a1ef4213dc)
    • cmake: get version from git ref (e5fd3f60e5d5cf28190d288bc13e0117d69ff493)
  3. 1.7.52024-03-27 · 2024-03-27 14:32 UTC
    查看更新说明

    Changelog

    • html: allow overriding client options with URL query (dea883a)
    • server: add --exit-no-conn option (#1029) (116ce8f)
    • html: add safari mobile full screen support (#946) (f79304f)
    • html: Add Unicode 11 xterm.js addon (#1310) (61a985e)
    • html: upgrade to xterm 5.4.0 (#1303) (09e7fd8)
    • add trzszDragInitTimeout option (#1238) (272f2f8)

    Full Changelog: https://github.com/tsl0922/ttyd/compare/1.7.4...1.7.5

  4. 1.7.42023-10-02 · 2023-10-02 07:29 UTC
    查看更新说明

    NOTE: You may encounter problems on windows 11, Read https://github.com/tsl0922/ttyd/issues/1207#issuecomment-1784424493

    Breaking Changes

    • The web terminal is readonly by default now, to make it writable, use -W option.

    Changelog

    • Leverage Docker Layer System (#1191) (c4beea2)
    • html: update dependencies (7a57d76)
    • build(deps): update zlib version 1.2.13 to 1.3 in cross-build.sh (#1193) (67ee27a)
    • server: print working directory on start (eb52df7)
    • server: replace --readonly with --writable (f8efcdd)
    • server: fix -U option not work (e46e3cf)
    • server: do not expose port to public by default (3920608)
    • Add -y flag for easier installation (#1024) (e12f321)
    • improve support for trzsz (#1084) (8c6c6ee)
    • info.max_http_header_data = 65535; (#1088) (945462a)
    • Add Docker pulls badge (#1092) (23eb4d3)
    • fix flow control (#1093) (01f1ed5)
    • Fix typo, OPTOINS -> OPTIONS (#1087) (a767971)
    • Bump CMake version to 2.8.12 (#1081) (fb65231)

    Full Changelog: https://github.com/tsl0922/ttyd/compare/1.7.3...1.7.4

  5. 1.7.32023-01-18 · 2023-01-18 03:48 UTC
    查看更新说明

    Breaking Change

    • Sixel support is off by default now, use -t enableSixel=true to enable it.
    • ZMODEM support is off by default now, use -t enableZmodem=true to enable it.

    Full Changelog: https://github.com/tsl0922/ttyd/compare/1.7.2...1.7.3

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    backend frontend GitHub Releases Docker Pulls Packaging status GitHub

    ttyd - Share your terminal over the web

    ttyd is a simple command-line tool for sharing terminal over the web.

    screenshot

    Features

    • Built on top of libuv and WebGL2 for speed
    • Fully-featured terminal with CJK and IME support
    • ZMODEM (lrzsz) / trzsz file transfer support
    • Sixel image output support (img2sixel / lsix)
    • SSL support based on OpenSSL / Mbed TLS
    • Run any custom command with options
    • Basic authentication support and many other custom options
    • Cross platform: macOS, Linux, FreeBSD/OpenBSD, OpenWrt, Windows

    Installation

    Install on macOS

    • Install with Homebrew: brew install ttyd
    • Install with MacPorts: sudo port install ttyd

    Install on Linux

    • Install on Debian/Ubuntu: sudo apt install ttyd
    • Install the snap: sudo snap install ttyd --classic
    • Install on OpenWrt: opkg install ttyd
    • Install on Gentoo: clone the repo and follow the directions here.
    • Install with Homebrew : brew install ttyd
    • Precompiled static binaries: download from the releases page

    Install on Windows

    Usage

    Command-line Options

    USAGE:
        ttyd [options] <command> [<arguments...>]
    
    OPTIONS:
        -p, --port              Port to listen (default: 7681, use `0` for random port)
        -i, --interface         Network interface to bind (eg: eth0), or UNIX domain socket path (eg: /var/run/ttyd.sock)
        -U, --socket-owner      User owner of the UNIX domain socket file, when enabled (eg: user:group)
        -c, --credential        Credential for basic authentication (format: username:password)
        -H, --auth-header       HTTP Header name for auth proxy, this will configure ttyd to let a HTTP reverse proxy handle authentication
        -u, --uid               User id to run with
        -g, --gid               Group id to run with
        -s, --signal            Signal to send to the command when exit it (default: 1, SIGHUP)
        -w, --cwd               Working directory to be set for the child program
        -a, --url-arg           Allow client to send command line arguments in URL (eg: http://localhost:7681?arg=foo&arg=bar)
        -W, --writable          Allow clients to write to the TTY (readonly by default)
        -t, --client-option     Send option to client (format: key=value), repeat to add more options
        -T, --terminal-type     Terminal type to report, default: xterm-256color
        -O, --check-origin      Do not allow websocket connection from different origin
        -m, --max-clients       Maximum clients to support (default: 0, no limit)
        -o, --once              Accept only one client and exit on disconnection
        -q, --exit-no-conn      Exit on all clients disconnection
        -B, --browser           Open terminal with the default system browser
        -I, --index             Custom index.html path
        -b, --base-path         Expected base path for requests coming from a reverse proxy (eg: /mounted/here, max length: 128)
        -P, --ping-interval     Websocket ping interval(sec) (default: 5)
        -6, --ipv6              Enable IPv6 support
        -S, --ssl               Enable SSL
        -C, --ssl-cert          SSL certificate file path
        -K, --ssl-key           SSL key file path
        -A, --ssl-ca            SSL CA file path for client certificate verification
        -d, --debug             Set log level (default: 7)
        -v, --version           Print the version and exit
        -h, --help              Print this text and exit
    

    Read the example usage on the wiki.

    Browser Support

    Modern browsers, See Browser Support.

    Alternatives