mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-03-24 02:20:09 +08:00
Merge pull request #6374 from lujun9972/add-tmate_–_Instantly_Share_Your_Terminal_Session_To_Anyone_In_Seconds
Add tmate – instantly share your terminal session to anyone in seconds
This commit is contained in:
commit
897d16611d
@ -0,0 +1,185 @@
|
||||
tmate -- Instantly Share Your Terminal Session To Anyone In Seconds
|
||||
=================
|
||||
|
||||
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.
|
||||
|
||||
Why you want tmate application? this will help you to get help from your
|
||||
friends when you need.
|
||||
|
||||
### What Is 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.
|
||||
|
||||
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.
|
||||
|
||||
A status line at the bottom of the screen shows information on the
|
||||
current session, such as ssh command to share with your mate.
|
||||
|
||||
### How tmate works?
|
||||
|
||||
- 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
|
||||
|
||||
### Prerequisites for 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.
|
||||
```shell
|
||||
$ ssh-keygen -t rsa
|
||||
Generating public/private rsa key pair.
|
||||
Enter file in which to save the key (/home/magi/.ssh/id_rsa):
|
||||
Enter passphrase (empty for no passphrase):
|
||||
Enter same passphrase again:
|
||||
Your identification has been saved in /home/magi/.ssh/id_rsa.
|
||||
Your public key has been saved in /home/magi/.ssh/id_rsa.pub.
|
||||
The key fingerprint is:
|
||||
SHA256:3ima5FuwKbWyyyNrlR/DeBucoyRfdOtlUmb5D214NC8 [email protected]
|
||||
The key's randomart image is:
|
||||
+---[RSA 2048]----+
|
||||
| |
|
||||
| |
|
||||
| . |
|
||||
| . . = o |
|
||||
| *ooS= . + o |
|
||||
| . [email protected]*o.o.+ E .|
|
||||
| =o==B++o = . |
|
||||
| o.+*o+.. . |
|
||||
| ..o+o=. |
|
||||
+----[SHA256]-----+
|
||||
```
|
||||
|
||||
### How to Install tmate
|
||||
|
||||
tmate is available in few of the distribution official repository that
|
||||
can be installed through package manager.
|
||||
|
||||
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.
|
||||
|
||||
```shell
|
||||
$ sudo apt-get install software-properties-common
|
||||
$ sudo add-apt-repository ppa:tmate.io/archive
|
||||
$ sudo apt-get update
|
||||
$ sudo apt-get install tmate
|
||||
```
|
||||
|
||||
Also, you can install tmate package from distribution official repository.
|
||||
|
||||
```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.
|
||||
|
||||
```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.
|
||||
|
||||
```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.
|
||||
|
||||
```shell
|
||||
$ sudo zypper in tmate
|
||||
```
|
||||
|
||||
### How To Use 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.
|
||||
|
||||
```shell
|
||||
$ tmate
|
||||
```
|
||||
|
||||
[](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.
|
||||
|
||||
```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)
|
||||
|
||||
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?
|
||||
|
||||
### How to connect session through SSH
|
||||
|
||||
Just run the SSH session ID which you got from your friend on terminal.
|
||||
It's like similar to below.
|
||||
|
||||
```shell
|
||||
$ ssh session: ssh [email protected]
|
||||
```
|
||||
|
||||
[](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
|
||||
|
||||
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)
|
||||
|
||||
|
||||
Just type `exit` to exit from the session.
|
||||
|
||||
```
|
||||
[Source System Output]
|
||||
[exited]
|
||||
|
||||
[Remote System Output]
|
||||
[server exited]
|
||||
Connection to sg2.tmate.io closed by remote host.
|
||||
Connection to sg2.tmate.io closed.
|
||||
```
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.2daygeek.com/tmate-instantly-share-your-terminal-session-to-anyone-in-seconds/
|
||||
|
||||
作者:[ Magesh Maruthamuthu ][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
Loading…
Reference in New Issue
Block a user