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 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.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Aaron Kili
Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.


Leave a Reply
  1. Good idea, but only if you host your own server.
    I would never trust my shell to anything that uses an internet service to work.


Leave a Reply to DDS Cancel reply

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.