tmate stands for teammates, it is just like teamviewer. It is fork of tmux and used for instant terminal sharing. It can share a terminal with single or multiple teammates.
How tmate works?
When launching tmate, an ssh session is established to tmate.io (backend servers maintained by tmate developers) in the background through libssh. Once connection is established, a 150 bits session token ID is generated by local server for each session. Finally teammates connect to tmate.io server using the SSH session token ID.
Prerequisites:
You must generate ssh key on your server, where you want to install tmate.
Install Tmate in Linux
On most Linux distributions, Tmate can be installed from the default repositories.
For Debian and Ubuntu-based run following commands to install Tmate.
apt-get install software-properties-common add-apt-repository ppa:tmate.io/archive apt-get update apt-get install tmate
Run below command for Tmate installation on FreeBSD
pkg install tmate
Run below command for Tmate installation on FreeBSD
pkg_add tmate
On Arch Linux, Run below command for Tmate installation
yaourt -S tmate
On Gento, run emerge commandv to install it.
emerge tmate
On Fedora use following command to install Tmate.
dnf install tmate
For CentOS and RHEL you need to follow below steps to install Tmate.
Step 1: Create Yum repository
Run below command
vi /etc/yum.repos.d/tmate.repo
And add below text in tmate.repo file
[osradar-tmate-repo] name=osradar tmate repo baseurl=http://li.nux.ro/download/nux/dextop/el7/x86_64/ gpgcheck=0 enabled=1
Now save changes and exit.
Step 2: Install Tmate on CentOS
Run below command
yum install tmate -y
Once you installed Tmate on your desired Linux distribution, launch Tmate by running the following command from your Terminal
tmate
After launching tmate, an SSH session token ID will be generated (In my case it is [email protected] ). You need to share it with your mates so that they can access your terminal.
To access your server terminal, your mate will need to open his/her terminal and run below command.
ssh [email protected]
You can use below command to see tmate stats
tmate show-messages
To exit from a session, type exit
exit