【devops】ttyd 一个web版本的shell工具 web版本shell工具 web shell

一、什么是 TTYD

ttyd是在web端一个简单的服务器命令行工具

类似我们在云厂商上直接ssh链接我们的服务器输入指令一样

二、安装ttyd

1、macOS

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

2、linux

  • Binary version (recommended): download from the releases page

  • Install with Homebrew : brew install ttyd

  • Install the snap: sudo snap install ttyd --classic

  • Build from source (debian/ubuntu):

    sudo apt-get update

    sudo apt-get install -y build-essential cmake git libjson-c-dev libwebsockets-dev

    git clone https://github.com/tsl0922/ttyd.git

    cd ttyd && mkdir build && cd build

    cmake ...

    make && sudo make install

You may also need to compile/install libwebsockets from source if the libwebsockets-dev package is outdated.

  • Install on OpenWrt: opkg install ttyd
  • Install on Gentoo: clone the repo and follow the directions here.

3、windows

  • Binary version (recommended): download from the releases page
  • Install with WinGet: winget install tsl0922.ttyd
  • Install with Scoop: scoop install ttyd

三、使用 ttyd

官方文档
https://github.com/tsl0922/ttyd/wiki/Example-Usage

1、使用说明

一定要查看这里的所有说明(如下:)

2、默认启动 客户端无法输入

直接启动指令如下:

复制代码
ttyd -p 8080 bash

这样启动,我们通过客户端访问

这里我们在页面输入啥都不可以!!!

3、包含Basic Auth 且 可修改

复制代码
ttyd -p 8080 -c root:123456-Ab@@ -W bash

4、包含Basic Auth 且 可修改 且 指定ip

复制代码
nohup ttyd  -p 8080 -B 127.0.0.1  -c root:123456-Ab@@ -W bash &
相关推荐
恋猫de小郭10 分钟前
最近 Android 有什么更新:Android Dev Summit 2026 技术解读
android·前端·flutter
计算机魔术师12 分钟前
Reddit 宣布转向以登录为主的体验,以应对 AI 搜索带来的流量下滑
前端
熊猫钓鱼>_>12 分钟前
上架审核常见驳回与隐私合规清单:过审前先自查这 8 条【鸿蒙心迹】
开发语言·前端·华为·华为云·harmonyos·openharmony·ai制作
missile11113 分钟前
# HDR 算法 ISP 通路客制化方案(G100 / mt6789)
java·前端·javascript
全栈陈序员35 分钟前
【Python】基础语法入门(三十)—— Web 开发入门:用 Flask 搭建第一个网站
前端·python·flask
万少41 分钟前
Harmony 7.0 这个skill帮你自动化操作AGC
前端·javascript·后端
小大宇1 小时前
Vue知识点-ElementPlus-02图标
前端·javascript·vue.js
简简单单就是我_hehe1 小时前
一次 ClickHouse 服务器磁盘告警的排查与修复实录
java·服务器·前端
java_nnnn1 小时前
spring web mvc图书管理小案例
前端·spring·mvc