【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 &
相关推荐
LuciferHuang7 小时前
震惊!三万star开源项目竟有致命Bug?
前端·javascript·debug
GISer_Jing7 小时前
前端实习总结——案例与大纲
前端·javascript
天天进步20157 小时前
前端工程化:Webpack从入门到精通
前端·webpack·node.js
姑苏洛言8 小时前
编写产品需求文档:黄历日历小程序
前端·javascript·后端
知识分享小能手9 小时前
Vue3 学习教程,从入门到精通,使用 VSCode 开发 Vue3 的详细指南(3)
前端·javascript·vue.js·学习·前端框架·vue·vue3
姑苏洛言9 小时前
搭建一款结合传统黄历功能的日历小程序
前端·javascript·后端
你的人类朋友10 小时前
🤔什么时候用BFF架构?
前端·javascript·后端
知识分享小能手10 小时前
Bootstrap 5学习教程,从入门到精通,Bootstrap 5 表单验证语法知识点及案例代码(34)
前端·javascript·学习·typescript·bootstrap·html·css3
一只小灿灿11 小时前
前端计算机视觉:使用 OpenCV.js 在浏览器中实现图像处理
前端·opencv·计算机视觉