【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 &
相关推荐
feixing_fx2 小时前
第一个 JS 程序:在浏览器控制台和 Node 中分别运行
开发语言·前端·javascript·前端框架·ecmascript
feixing_fx4 小时前
变量与声明:let、const、var 的选择边界
开发语言·前端·javascript·前端框架
JavaGuide6 小时前
Cloudflare 开源的这套神级安全审计 Skill 太好用了!
前端·后端
孟健7 小时前
用 unslop 拯救 AI 生成网页的塑料感,7 分钟重构落地实测
前端·人工智能·ai编程
feixing_fx7 小时前
JavaScript 是什么:从浏览器脚本到通用编程语言
开发语言·前端·javascript·前端框架·ecmascript
丘山望岳7 小时前
【开发工具】 cluade code常用快捷键
前端
小巫编程室8 小时前
我造了一个 Java 能力包:让 AI 直接调用你的业务代码
java·前端·后端
小y的笔记8 小时前
JavaScript URL 状态同步
前端·javascript
十有八七8 小时前
手搓 Agent(五):学会翻书——RAG,先查资料再回答
前端·人工智能·后端
Swot8 小时前
产品 RAG 知识库与 AI 顾问 设计与实现
前端·后端