【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 &
相关推荐
No8g攻城狮6 分钟前
【前端】Vue 中 const、var、let 的区别
前端·javascript·vue.js
文心快码BaiduComate11 分钟前
Comate搭载Kimi K2.6,长程13h!
前端·后端·程序员
豹哥学前端21 分钟前
新手小白学前端day4: Position定位
前端
fishmemory7sec27 分钟前
Vue大屏自适应容器组件:v-scale-screen
前端·javascript·vue.js
饺子不吃醋28 分钟前
Promise原理、手写与 async、await
前端·javascript
PILIPALAPENG32 分钟前
第3周 Day 2:Function Calling —— 让 Agent 听懂人话,自己干活
前端·人工智能·python
袋鼠云数栈UED团队1 小时前
基于 OpenSpec 实现规范驱动开发
前端·人工智能
JarvanMo1 小时前
GetX 作者的 GitHub 账号被封,又默默恢复了——但问题远没有解决
前端
大黄说说2 小时前
HTML5语义化标签:从div到article与section的进化之路
前端·html·html5
帅小伙―苏2 小时前
力扣42接雨水
前端·算法·leetcode