1
TMP_DIR=$(mktemp -d) && trap 'rm -rf "$TMP_DIR"' EXIT && curl -fsSL https://github.com/owenthereal/upterm/releases/download/v0.20.0/upterm_linux_amd64.tar.gz | tar -xz -C "$TMP_DIR" && "$TMP_DIR"/upterm host && rm -rf "$TMP_DIR"

upterm 是 tmate.io 的替代品

该命令会在执行完成后删除 upterm 文件

然后会打印出来

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
╭─ Session: oNWF9treC2UudFSY7Ztx ─╮
┌─────────┬────────────────────── ┐
│ Command:         │ /bin/bash                                   │
│ Force Command:   │ n/a                                         │
│ Host:            │ ssh://uptermd.upterm.dev:22                 │
│ Authorized Keys: │ n/a                                         │
│                  │                                             │
│ ➤ SSH Command:   │ ssh [email protected]└─────────┴────────────────────── ┘

╰─ Run 'upterm session current' to display this again ─╯

🤝 Accept connections? [y/n] (or <ctrl-c> to force exit)

按 y 即可共享终端

然后输入 exit 执行可退出共享终端

其他人使用 ssh [email protected]​ 即可连接到该共享终端

其中 upterm 的服务器也可以自行部署