【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 &
相关推荐
Java后端的Ai之路7 分钟前
03_React_JSX
前端·react.js·前端框架
颜进强26 分钟前
26 · NestJS 基础篇 · 全专栏总结:五个阶段,一次收拢
前端·后端·ai编程
风寄巴山秋27 分钟前
OpenBMC:Web 页面功能异常排查
运维·服务器·前端·架构
程序员Sunday1 小时前
Promise.all、allSettled、race、any 怎么选,失败后其他请求会怎样
开发语言·前端·javascript
niucloud-admin1 小时前
JAVA V6 多商户商城 开发文档——管理端前端
前端
weixin_422201301 小时前
如何解决小程序图标点击热区小,落点不准问题?
前端·小程序·样式·点击热区·扩大
szial2 小时前
JavaScript 的 call、apply 和 bind:如何控制函数调用
开发语言·前端·javascript
CopyCode2 小时前
Agent 开发不是模型训练:一个前端的入门认知
前端·llm·agent
吠品2 小时前
HTTPS 真身:HTTP 套了层 TLS
java·服务器·前端
JYeontu2 小时前
实现一个「曲线滑块验证」功能
前端·javascript·html