【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 &
相关推荐
行走的陀螺仪36 分钟前
uni-app + Vue3编辑页/新增页面给列表页传参
前端·vue.js·uni-app
We་ct2 小时前
LeetCode 205. 同构字符串:解题思路+代码优化全解析
前端·算法·leetcode·typescript
2301_812731412 小时前
CSS3笔记
前端·笔记·css3
ziblog2 小时前
CSS3白云飘动动画特效
前端·css·css3
越努力越幸运5082 小时前
CSS3学习之网格布局grid
前端·学习·css3
半斤鸡胗2 小时前
css3基础
前端·css
ziblog2 小时前
CSS3创意精美页面过渡动画效果
前端·css·css3
akangznl2 小时前
第四章 初识css3
前端·css·css3·html5
会豪2 小时前
深入理解 CSS3 滤镜(filter):从基础到实战进阶
前端·css·css3
头顶一只喵喵2 小时前
CSS3进阶知识:CSS3盒子模型,box-sizing:content-box和box-sizing:border-box的讲解
前端·css·css3