Take yourself, share your terminal instantly with anyone

take website

In the next article we are going to take a look at Tmate. In the Gnu / linux world there are several popular programs to share a desktop remotely (like Teamviewer, Guacamole and TigerVNC, etc). These programs are used to share your entire screen with other people. If it is only the terminal that we want to share, Tmate is possibly the best option. Actually this program is a fork of Tmux. Tmate is something like a Teamviewer for our terminal.

Take yourself will establish a secure connection via SSH to the tmate.io website and generate a random URL for each session. The generated URL can be shared with someone we trust. This will allow us to use the terminal remote in the way we would use our own, as long as the connection is active. It's a great option for collaborating on common projects, debugging a project with a team of developers, or getting technical support remotely. This program is compatible with GNU / Linux, Mac OSX and BSD.

Tmate installation on Ubuntu and derivatives

In Ubuntu, and its derivatives like Linux Mint, you can install this program using the following PPA in terminal (Ctrl + Alt + T). Although before that, we will have to install the necessary package by typing:

sudo apt-get install software-properties-common

Now we can add the PPA to our system and install the program. For this we write the following sequence of commands:

sudo add-apt-repository ppa:tmate.io/archive && sudo apt-get update && sudo apt-get install tmate

Configure SSH

configuring ssh

Before you start using this program, we need to create an SSH key pair. Because the tmate program establishes a secure SSH connection to tmate.io using the local SSH key pair. We will achieve this by writing the following in our terminal (Ctrl + Alt + T):

ssh-keygen -t rsa

Use of Tmate

Once the SSH key pair has been created, we will start Tmate by executing the following command from its Terminal:

tmate

When the session is established, we can share the ID of the connection with anyone. It can be shared with any number of people you trust. They don't need to be on the same network nor do they need to use the same operating system. They don't even have to have tmate or tmux installed on their systems.

This is what Tmate sessions look like:

tmate sessions

As seen in the screenshot above, it will show us an SSH session ID (a string of random characters) at the bottom of the terminal. We will simply have to copy it and share it with others so that they can connect. Keep in mind that this ID will disappear after a few seconds. However, we will be able to see the session IDs that have been used using the following command:

tmate show-messages

The output of the above command would be something like the following:

time show messages

As you can see from the output above, you can share the terminal via SSH session or web session. For this we will have to use the respective session IDs. Also, you can share the read-only session or the read-write session.

Connect through SSH sessions

For those users who want to share the Terminal via SSH sessions, you will have to provide the SSH session ID to remote users.

For example and using the IDs generated in the previous screenshot. Remote users should type the following command to access the read-only session that has been generated on the system.

ssh ro-w3boCOq2a5rLDpFnFRUudKTH5@am2.tmate.io

In the read-only session, remote users can only see the Terminal. They cannot execute any commands.

To share the read and write session, the command to send would be:

ssh R1bXaNj7ZM9r5459Dgpuyl8gS@am2.tmate.io

In this case, remote users can access the terminal in read-write mode. That means they can run any command. All the commands you write in the remote session can also be seen from your local Terminal.

Connect through web sessions

For those who want to share the Terminal through a web browser, they will simply have to pass the web URL to others to connect.

Let's say for example that to share reading and writing I would have to give the following URL to my co-workers: https://tmate.io/t/R1bXaNj7ZM9r5459Dgpuyl8gS

When they open this URL in the browser, it will look something like the following screenshot:

tmate web browser

To exit a session, just type in the terminal exit. If anyone needs more details about this program, you can consult the man pages that it makes available to us. We can also get more information at the project website.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Giovanni gapp said

    Very interesting concept