Tmate – Securely Share SSH Terminal Session with Linux Users

tmate is a clone of tmux (terminal multiplexer) that provides a secure, instant and easy-to-use terminal sharing solution over an SSH connection. It is built on top of tmux; you can run both terminal...

Spread the love

tmate is a clone of tmux (terminal multiplexer) that provides a secure, instant and easy-to-use terminal sharing solution over an SSH connection. It is built on top of tmux; you can run both terminal emulators on the same system. You can either use the official servers at or host your own tmate server.

The following figure shows a simplified architecture diagram with the different components of the tmate (obtained from the project website).

tmate - Simplified Architecture Diagram

tmate – Simplified Architecture Diagram

How Tmate Works?

When launching Tmate, it will first establish an ssh connection to server in the background through libssh. Once the connection is established, a 150 bits session token is generated for each session. Trusted users can use this generated token to access terminal session.

How to Install Tmate in Linux

Tmate is available to install from the default repositories of most Linux distributions using package manager as shown.

In Debian and Ubuntu-based Linux distributions, use the following PPA to install Tmate.

$ sudo apt-get install software-properties-common
$ sudo add-apt-repository $ sudo apt-get update $ sudo apt-get install tmate

On Fedora distribution, use the following dnf command.

$ sudo dnf install tmate

On Arch Linux, you can install it from AUR as shown.

$ yaourt -S tmate

In openSUSE, you can use zypper command to install it.

$ sudo zypper in tmate

On Gento, you can use emerge to install it.

$ sudo emerge tmate

On other Linux distributions such as CentOS and RHEL, you can download sources from and compile and install with the following commands.

$ ./ $ ./configure $ make $ sudo make install

How to Share Your Terminal Using Tmate

Once you have installed tmate, it uses both ~/.tmux.conf and ~/.tmate.conf configuration files. Everyone you share your terminal with, will be using your tmux config and your key bindings. The terminal is forced to 256 colors and UTF-8, so you don’t need to pass -2 as you may be used to do with tmux.

To launch tmate, run the following command, which makes the program to establish an ssh connection to (or your own server) in the background through libssh.

$ tmate 

Tmate Session

Tmate Session

Then you can share the ssh session connection parameters using generated token ID (for example: [email protected] in this case) with your mates so that they can access your terminal.

To access your terminal, your friend/colleagues needs to run the following ssh command in their terminal.

$ ssh [email protected]

Tmate Session Sharing with Friends

Tmate Session Sharing with Friends

To show tmate’s log messages, including the ssh connection string, run:

$ tmate show-messages

Tmate Log Messages

Tmate Log Messages

tmate also allows you to share a read-only view of your terminal. The read-only connection string can be retrieved with tmate show-messages as shown in the above screenshot.

To terminate the program, run the exit command.

$ exit

For more information on how tmate works, how to run it as a daemon and host your own tmate server, go to the project website:

Tmate is a fork of tmux that provides a secure, instant terminal sharing solution. In this article, we have shown how to install and use tmate in Linux and use it to share your terminal with your mates. Feel free to share your thoughts with us via the feedback form below.

Facebook Comments

More Stuff

ext3grep – Recover Deleted Files on Debian and Ubuntu ext3grep is a simple program for recovering files on an EXT3 filesystem. It is an investigation and recovery tool that is useful in forensics investig... – Easy File Sharing from Linux Commandline is a simple, easy and fast service for file sharing from the command-line. It allows you to upload up to 10GB of data and files are stored...
DCP – Transfer Files Between Linux Hosts Using Peer-to-Peer Networ... People often need to copy or share files over the network. Many of us are used to using tools such as rsync or scp to transfer files between machines....
Firejail – Securely Run Untrusted Applications in Linux Sometimes you may want to use applications that have not been well tested in different environments, yet you must use them. In such cases, it is norma...
Spread the love

Posted by News Monkey