mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-13 22:30:37 +08:00
translated
This commit is contained in:
parent
d410a07fa5
commit
148c5365cd
@ -1,49 +1,31 @@
|
||||
translating by darksun
|
||||
tmate -- Instantly Share Your Terminal Session To Anyone In Seconds
|
||||
tmate -- 秒级分享你的终端会话
|
||||
=================
|
||||
|
||||
A while ago, we wrote about
|
||||
[teleconsole](https://www.2daygeek.com/teleconsole-share-terminal-session-instantly-to-anyone-in-seconds/)
|
||||
which is used to share terminal instantly to anyone (whoever you trusting). Today also we are going to discuss about same kind of
|
||||
application called tmate.
|
||||
不久前,我们写过一篇关于 [teleconsole](https://www.2daygeek.com/teleconsole-share-terminal-session-instantly-to-anyone-in-seconds/) 的介绍,该工具可用于快速分享终端给任何人(任何你信任的人)。今天我们要聊一聊另一款类似的应用,名叫 `tmate`。
|
||||
|
||||
Why you want tmate application? this will help you to get help from your
|
||||
friends when you need.
|
||||
`tmate` 有什么用? 它可以让你在需要帮助时向你的朋友们求助。
|
||||
|
||||
### What Is tmate?
|
||||
### 什么是 tmate?
|
||||
|
||||
[tmate](https://tmate.io/) stands for teammates, it's a fork of tmux,
|
||||
and uses the same configurations such as keybindings, color schemes etc.
|
||||
It's a terminal multiplexer with instant terminal sharing. it enables a
|
||||
number of terminals to be created, accessed, and controlled from a
|
||||
single screen, that can be shared with another mates.
|
||||
[tmate](https://tmate.io/) 的意思是 `teammates`, 它是 tmux 的一个分支,并且使用相同的配置信息(例如快捷键配置,配色方案等).
|
||||
它是一个终端多路复用器,同时具有即时分享终端的能力。它允许在单个屏幕中创建并操控多个终端,同时这些终端还能与其他同事分享。
|
||||
|
||||
You can detach the session by leaving the job running in background and
|
||||
re-attach the session when you want to view the status. tmate provides
|
||||
an instant pairing solution, allowing you to share a terminal with one
|
||||
or several teammates.
|
||||
你可以分离会话,让作业在后台运行,然后在想要查看状态时重新连接会话. `tmate` 提供了一个即时配对的方案, 让你可以与一个或多个队友共享一个终端.
|
||||
|
||||
A status line at the bottom of the screen shows information on the
|
||||
current session, such as ssh command to share with your mate.
|
||||
在屏幕的地步有一个状态栏,显示了当前会话的一些诸如 ssh 命令之类的共享信息.
|
||||
|
||||
### How tmate works?
|
||||
### tmate 是怎么工作的?
|
||||
|
||||
- When launching tmate, an ssh connection is established to tmate.io
|
||||
(backend servers maintained by tmate developers) in the background
|
||||
through libssh.
|
||||
- The server (tmate.io) ssh key signatures are verified during the DH
|
||||
exchange.
|
||||
- The client is authenticated with local ssh keys.
|
||||
- Once connection is established, a 150 bits (non guessable random
|
||||
characters) session token is generated by local tmux server.
|
||||
- teammates can connect to tmate.io using the SSH session ID provided
|
||||
by user
|
||||
- 运行 `tmate` 时, 会通过 `libssh` 在后台创建一个连接到 tmate.io (由 tmate 开发者维护的后台服务器)的ssh 连接.
|
||||
- 服务器 (tmate.io) 的 ssh 密钥前面通过 DH 交换进行校验.
|
||||
- 客户端通过本地 ssh 密钥进行认证.
|
||||
- 连接创建后, 本地 tmux 服务器会生成一个 150 位(不可猜测的随机字符)会话令牌.
|
||||
- 队友能通过用户提供的 SSH 会话 ID 连接到 tmate.io.
|
||||
|
||||
### Prerequisites for tmate
|
||||
### 使用 tmate 的必备条件
|
||||
|
||||
Generate SSH key as a prerequisites since tmate.io server authenticate
|
||||
client machine through local ssh keys. Make a note, every system should
|
||||
have SSH key.
|
||||
由于 `tmate.io` 服务器需要通过本地 ssh 密钥来认证客户机,因此其中一个必备条件就是生成 SSH 密钥 key.
|
||||
记住, 每个系统都要有自己的 SSH 密钥.
|
||||
```shell
|
||||
$ ssh-keygen -t rsa
|
||||
Generating public/private rsa key pair.
|
||||
@ -68,13 +50,12 @@ The key's randomart image is:
|
||||
+----[SHA256]-----+
|
||||
```
|
||||
|
||||
### How to Install tmate
|
||||
### 如何安装 tmate
|
||||
|
||||
tmate is available in few of the distribution official repository that
|
||||
can be installed through package manager.
|
||||
`tmate` 已经包含在某些发行版的官方仓库中,可以通过包管理器来安装.
|
||||
|
||||
For **`Debian/Ubuntu`**, use [APT-GET Command](https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/)
|
||||
or [APT Command](https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/)to install tmate.
|
||||
对于 **`Debian/Ubuntu`**, 可以使用 [APT-GET 命令](https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/)
|
||||
或者 [APT 命令](https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/)to 来安装.
|
||||
|
||||
```shell
|
||||
$ sudo apt-get install software-properties-common
|
||||
@ -83,86 +64,75 @@ $ sudo apt-get update
|
||||
$ sudo apt-get install tmate
|
||||
```
|
||||
|
||||
Also, you can install tmate package from distribution official repository.
|
||||
你也可以从官方仓库中安装 tmate.
|
||||
|
||||
```shell
|
||||
$ sudo apt-get install tmate
|
||||
```
|
||||
|
||||
For **`Fedora`**, use [DNF Command](https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/)
|
||||
to install tmate.
|
||||
对于 **`Fedora`**, 使用 [DNF 命令](https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/) 来安装.
|
||||
|
||||
```shell
|
||||
$ sudo dnf install tmate
|
||||
```
|
||||
|
||||
For **`Arch Linux`** based systems, use []()[Yaourt Command](https://www.2daygeek.com/install-yaourt-aur-helper-on-arch-linux/)
|
||||
or []()[Packer Command](https://www.2daygeek.com/install-packer-aur-helper-on-arch-linux/)
|
||||
to install tmate from AUR repository.
|
||||
对于基于 **`Arch Linux`** 的系统, 使用 []()[Yaourt 命令](https://www.2daygeek.com/install-yaourt-aur-helper-on-arch-linux/)
|
||||
或 []()[Packer 命令](https://www.2daygeek.com/install-packer-aur-helper-on-arch-linux/) 来从 AUR 仓库中安装.
|
||||
|
||||
```shell
|
||||
$ yaourt -S tmate
|
||||
```
|
||||
or
|
||||
或
|
||||
|
||||
```shell
|
||||
$ packer -S tmate
|
||||
```
|
||||
|
||||
For **`openSUSE`**, use [Zypper Command](https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/)
|
||||
to install tmate.
|
||||
对于 **`openSUSE`**, 使用 [Zypper 命令](https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/) 来安装.
|
||||
|
||||
```shell
|
||||
$ sudo zypper in tmate
|
||||
```
|
||||
|
||||
### How To Use tmate
|
||||
### 如何使用 tmate
|
||||
|
||||
After successfully installed, open your terminal and fire the following
|
||||
command which will open the new session for you and in the bottom of the
|
||||
screen you can able to see the SSH session ID.
|
||||
成功安装后, 打开终端然后输入下面命令,就会打开一个新的会话,在屏幕底部,你能看到 SSH 会话的 ID.
|
||||
|
||||
```shell
|
||||
$ tmate
|
||||
```
|
||||
|
||||
[](https://www.2daygeek.com/wp-content/uploads/2017/11/tmate-instantly-share-your-terminal-session-to-anyone-in-seconds-1.png)
|
||||
![](https://www.2daygeek.com/wp-content/uploads/2017/11/tmate-instantly-share-your-terminal-session-to-anyone-in-seconds-1.png)
|
||||
|
||||
Make a note, the SSH session ID will disappear after a few seconds, so
|
||||
don't worry you can get those details using following command.
|
||||
要注意的是, SSH 会话 ID 会在几秒后消失, 不过不要紧,你可以通过下面命令获取到这些详细信息.
|
||||
|
||||
```shell
|
||||
$ tmate show-messages
|
||||
```
|
||||
|
||||
The tmate show-messages command allows you to see tmate's log messages,
|
||||
including the ssh connection string.\
|
||||
[](https://www.2daygeek.com/wp-content/uploads/2017/11/tmate-instantly-share-your-terminal-session-to-anyone-in-seconds-2.png)
|
||||
`tmate` 的 `show-messages` 命令会显示 tmate 的 log 信息,其中包含了 ssh 连接内容。
|
||||
![](https://www.2daygeek.com/wp-content/uploads/2017/11/tmate-instantly-share-your-terminal-session-to-anyone-in-seconds-2.png)
|
||||
|
||||
Now, share your SSH session ID to your friends or coworkers and allow
|
||||
them to view the terminal session. Not only SSH session ID,
|
||||
alternatively you can share web URL as well, also you can share either
|
||||
read only sessions or read-write sessions?
|
||||
现在, 分享你的 SSH 会话 ID 给你的朋友或同事从而允许他们观看终端会话. 除了 SSH 会话 ID 以外,你也可以分享 web URL。
|
||||
另外你还可以选择分享的是只读会话还是可读写会话。
|
||||
|
||||
### How to connect session through SSH
|
||||
### 如何通过 SSH 连接会话
|
||||
|
||||
Just run the SSH session ID which you got from your friend on terminal.
|
||||
It's like similar to below.
|
||||
只需要在终端上运行你从朋友那得到的 SSH 终端 ID 就行了. 类似下面这样。
|
||||
|
||||
```shell
|
||||
$ ssh session: ssh [email protected]
|
||||
$ ssh session: ssh 3KuRj95sEZRHkpPtc2y6jcokP@sg2.tmate.io
|
||||
```
|
||||
|
||||
[](https://www.2daygeek.com/wp-content/uploads/2017/11/tmate-instantly-share-your-terminal-session-to-anyone-in-seconds-4.png)
|
||||
![](https://www.2daygeek.com/wp-content/uploads/2017/11/tmate-instantly-share-your-terminal-session-to-anyone-in-seconds-4.png)
|
||||
|
||||
### How to connect session through Web URL
|
||||
### 如何通过 Web URL 连接会话
|
||||
|
||||
Open the browser and access the URL which you got from your friend. It's
|
||||
like similar to below.\
|
||||
[](https://www.2daygeek.com/wp-content/uploads/2017/11/tmate-instantly-share-your-terminal-session-to-anyone-in-seconds-3.png)
|
||||
打开浏览器然后访问朋友给你的 URL 就行了. 像下面这样.
|
||||
![](https://www.2daygeek.com/wp-content/uploads/2017/11/tmate-instantly-share-your-terminal-session-to-anyone-in-seconds-3.png)
|
||||
|
||||
|
||||
Just type `exit` to exit from the session.
|
||||
只需要输入 `exit` 就能退出会话了.
|
||||
|
||||
```
|
||||
[Source System Output]
|
||||
|
Loading…
Reference in New Issue
Block a user