https://github.com/yudai/gotty
使用 Golang 编写, 使用方便, 一般是用于通过 Web 来分享你的终端, 也可以用 -w 参数, 允许控制终端. 我一般把它当作一个 Web Shell 来使用, 同类产品相比, 部署更方便, 资源占用更优.
gotty -a localhost6 -p 58080 -w bash
就可以通过浏览器访问了, 一般, 我会加上 nginx 反向代理, 并作身份验证:
upstream gotty {
server localhost6:58080;
keepalive 16;
}
server {
server_name gotty.*;
auth_basic "login gotty";
auth_basic_user_file htpw;
location / {
proxy_pass http://gotty;
}
}
preferences {
font_family = "monospace"
font_size = 12
}
gotty:
image: lwzm/gotty
tty: true # required
volumes:
- /etc/localtime:/etc/localtime:ro
- /:/mnt/
ttyd:
image: tsl0922/ttyd:alpine
volumes:
- /etc/localtime:/etc/localtime:ro
- /:/mnt/