search
HomeSystem TutorialLINUXQuick terminal session sharing tool:tmate

Quick terminal session sharing tool:tmate

Feb 20, 2024 am 11:04 AM
linuxlinux tutorialRed Hatlinux systemlinux commandlinux certificationred hat linuxlinux video

What is tmate?

tmate means teammates, which is a fork of tmux and uses the same configuration information (such as shortcut key configuration, color scheme, etc.). It is a terminal multiplexer with the ability to share terminals on the fly. It allows the creation and manipulation of multiple terminals from a single screen, which can also be shared with other colleagues.

You can detach the session, let the job run in the background, and then reconnect to the session when you want to view the status. tmate provides an instant pairing solution that allows you to share a terminal with one or more teammates.

There is a status bar on the screen, which displays some shared information of the current session such as ssh commands.

How does tmate work?

When running tmate, an ssh connection to tmate.io (the backend server maintained by the tmate developer) will be created in the background through libssh.
The tmate.io server's ssh keys are verified via a DH exchange.
Clients authenticate via local ssh keys.
After the connection is created, the local tmux server generates a 150-bit (unguessable random characters) session token.
Teammates can connect to tmate.io via a user-supplied SSH session ID.

Prerequisites for using tmate

Since the tmate.io server requires a local ssh key to authenticate the client, one of the prerequisites is to generate an SSH key. Remember, each system needs its own SSH key.

$ 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 magi@magi-VirtualBox
The key's randomart image is:
+---[RSA 2048]----+
|                 |
|                 |
|           .     |
|      . . =   o  |
|     *ooS= . + o |
|  . =.@*o.o.+ E .|
|   =o==B++o  = . |
|  o.+*o+..    .  |
| ..o+o=.         |
+----[SHA256]-----+
How to install tmate

tmate is already included in the official repositories of some distributions and can be installed through the package manager.

For Debian/Ubuntu, you can use the APT-GET command or the APT command to install.

$ sudo apt-get install software-properties-common
$ sudo add-apt-repository ppa:tmate.io/archive
$ sudo apt-get update
$ sudo apt-get install tmate

You can also install tmate from the official repository.

$ sudo apt-get install tmate

For Fedora, use the DNF command to install.

$ sudo dnf install tmate

For systems based on Arch Linux, use the Yaourt command or the Packer command to install from the AUR repository.

$ yaourt -S tmate

or

$ packer -S tmate

For openSUSE, use the Zypper command to install.

$ sudo zypper in tmate
How to use tmate

After successful installation, open a terminal and enter the following command. A new session will open. At the bottom of the screen, you can see the SSH session ID.

$ tmate
<img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/465/014/170839825763674.png?x-oss-process=image/resize,p_40" class="lazy" alt="Quick terminal session sharing tool:tmate">

It should be noted that the SSH session ID will disappear after a few seconds, but it does not matter, you can obtain these details through the following command.

$ tmate show-messages

The show-messages command of tmate will display the log information of tmate, which contains the content of the ssh connection.

Quick terminal session sharing tool:tmate

Now, share your SSH session ID with your friends or colleagues to allow them to view the terminal session. In addition to the SSH session ID, you can also share the web URL.

In addition, you can also choose whether to share a read-only session or a read-write session.

How to connect to a session via SSH

Just run the SSH terminal ID you got from your friend on the terminal. Something like this.

$ ssh session: ssh [email protected]

Quick terminal session sharing tool:tmate

How to connect a session via a web URL

Just open the browser and visit the URL your friend gave you. Like below.

Quick terminal session sharing tool:tmate

Just enter exit to exit 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。

The above is the detailed content of Quick terminal session sharing tool:tmate. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:Linux就该这么学. If there is any infringement, please contact admin@php.cn delete
What are the main tasks of a Linux system administrator?What are the main tasks of a Linux system administrator?Apr 19, 2025 am 12:23 AM

The main tasks of Linux system administrators include system monitoring and performance tuning, user management, software package management, security management and backup, troubleshooting and resolution, performance optimization and best practices. 1. Use top, htop and other tools to monitor system performance and tune it. 2. Manage user accounts and permissions through useradd commands and other commands. 3. Use apt and yum to manage software packages to ensure system updates and security. 4. Configure a firewall, monitor logs, and perform data backup to ensure system security. 5. Troubleshoot and resolve through log analysis and tool use. 6. Optimize kernel parameters and application configuration, and follow best practices to improve system performance and stability.

Is it hard to learn Linux?Is it hard to learn Linux?Apr 18, 2025 am 12:23 AM

Learning Linux is not difficult. 1.Linux is an open source operating system based on Unix and is widely used in servers, embedded systems and personal computers. 2. Understanding file system and permission management is the key. The file system is hierarchical, and permissions include reading, writing and execution. 3. Package management systems such as apt and dnf make software management convenient. 4. Process management is implemented through ps and top commands. 5. Start learning from basic commands such as mkdir, cd, touch and nano, and then try advanced usage such as shell scripts and text processing. 6. Common errors such as permission problems can be solved through sudo and chmod. 7. Performance optimization suggestions include using htop to monitor resources, cleaning unnecessary files, and using sy

What is the salary of Linux administrator?What is the salary of Linux administrator?Apr 17, 2025 am 12:24 AM

The average annual salary of Linux administrators is $75,000 to $95,000 in the United States and €40,000 to €60,000 in Europe. To increase salary, you can: 1. Continuously learn new technologies, such as cloud computing and container technology; 2. Accumulate project experience and establish Portfolio; 3. Establish a professional network and expand your network.

What is the main purpose of Linux?What is the main purpose of Linux?Apr 16, 2025 am 12:19 AM

The main uses of Linux include: 1. Server operating system, 2. Embedded system, 3. Desktop operating system, 4. Development and testing environment. Linux excels in these areas, providing stability, security and efficient development tools.

Does the internet run on Linux?Does the internet run on Linux?Apr 14, 2025 am 12:03 AM

The Internet does not rely on a single operating system, but Linux plays an important role in it. Linux is widely used in servers and network devices and is popular for its stability, security and scalability.

What are Linux operations?What are Linux operations?Apr 13, 2025 am 12:20 AM

The core of the Linux operating system is its command line interface, which can perform various operations through the command line. 1. File and directory operations use ls, cd, mkdir, rm and other commands to manage files and directories. 2. User and permission management ensures system security and resource allocation through useradd, passwd, chmod and other commands. 3. Process management uses ps, kill and other commands to monitor and control system processes. 4. Network operations include ping, ifconfig, ssh and other commands to configure and manage network connections. 5. System monitoring and maintenance use commands such as top, df, du to understand the system's operating status and resource usage.

Boost Productivity with Custom Command Shortcuts Using Linux AliasesBoost Productivity with Custom Command Shortcuts Using Linux AliasesApr 12, 2025 am 11:43 AM

Introduction Linux is a powerful operating system favored by developers, system administrators, and power users due to its flexibility and efficiency. However, frequently using long and complex commands can be tedious and er

What is Linux actually good for?What is Linux actually good for?Apr 12, 2025 am 12:20 AM

Linux is suitable for servers, development environments, and embedded systems. 1. As a server operating system, Linux is stable and efficient, and is often used to deploy high-concurrency applications. 2. As a development environment, Linux provides efficient command line tools and package management systems to improve development efficiency. 3. In embedded systems, Linux is lightweight and customizable, suitable for environments with limited resources.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)