一、什么是 TTYD
ttyd是在web端一个简单的服务器命令行工具
 类似我们在云厂商上直接ssh链接我们的服务器输入指令一样

二、安装ttyd
1、macOS
Install with Homebrew: brew install ttydInstall with MacPorts: sudo port install ttyd2、linux
Binary version (recommended):download from the releases pageInstall with Homebrew : brew install ttydInstall the snap: sudo snap install ttyd --classicBuild from source (debian/ubuntu): sudo apt-get updatesudo apt-get install -y build-essential cmake git libjson-c-dev libwebsockets-devgit clone https://github.com/tsl0922/ttyd.gitcd ttyd && mkdir build && cd buildcmake ..make && sudo make installYou may also need to compile/install libwebsockets from source if the libwebsockets-dev package is outdated.
Install on OpenWrt:opkg install ttydInstall on Gentoo: clone the repo and follow the directions here. 3、windows
Binary version (recommended):download from the releases pageInstall with WinGet: winget install tsl0922.ttydInstall 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 bash4、包含Basic Auth 且 可修改 且 指定ip
nohup ttyd  -p 8080 -B 127.0.0.1  -c root:123456-Ab@@ -W bash &