Tmate: Instant Terminal Sharing
Useful links
As usual, links before everything
- Official website: tmate.io
 - Github: github.com/tmate-io/tmate
 
Overview
Want to do pair programming with your buddies over the net? Do you like tmux?
Enter tmate.
Key points
Briefly,
tmateis a fork of tmux - this means thattmateis also a terminal multiplexer and we can reuse our favourite.tmux.confand feel very much at home.- Once a 
tmatesession has been created, others can ssh connect to the session and do live pair programming in the terminal at the same time. There’s also an option for READ only sharing. tmatesession can be used for remote access purposes as well.- By default, we get random ephemeral connection string like 
ssh vbBK63dtemNN2ppDUqSvYNqbD@nyc1.tmate.io. It is possible to “name” the session and make the connection string deterministic and stable across restarts. Check out the docs for more info. - But what if I want to prevent strangers from joining my session?
Easy! Pass in anauthorized_keysfile containing authorized public keys we want to allow connecting to the session. - Want to go super secure? Go host your own tmate servers!
 
TLDR? tmate is basically a reverse ssh tunnel accessible from anywhere.
Installation
I recommend checking out installation guide at https://tmate.io/#installation.
For me I used the following commands
▶ curl -Ls https://github.com/tmate-io/tmate/releases/download/2.4.0/tmate-2.4.0-static-linux-amd64.tar.xz | tar xf - -C /tmp -J
▶ sudo mv /tmp/tmate-2.4.0-static-linux-amd64/tmate /usr/local/bin
▶ tmate -V
tmate 2.4.0
Usage
- Start a 
tmatesession▶ tmate - Start a 
tmatesession, allowing only authorized SSH clients to connecttmate -a authorized_keysWhere
authorized_keyscontains public keys that are allowed to connect - Grab ssh connection string within 
tmatesession▶ tmate show-messages Mon Jan 24 17:57:01 2022 [tmate] Connecting to ssh.tmate.io... Mon Jan 24 17:57:02 2022 [tmate] Note: clear your terminal before sharing readonly access Mon Jan 24 17:57:02 2022 [tmate] web session read only: https://tmate.io/t/ro-tnLSDQsQD5W9SyqXJB3EaUAWQ Mon Jan 24 17:57:02 2022 [tmate] ssh session read only: ssh ro-tnLSDQsQD5W9SyqXJB3EaUAWQ@sfo2.tmate.io Mon Jan 24 17:57:02 2022 [tmate] web session: https://tmate.io/t/sn6U6B4QAEehNAUznSu8Q2kSg Mon Jan 24 17:57:02 2022 [tmate] ssh session: ssh sn6U6B4QAEehNAUznSu8Q2kSg@sfo2.tmate.io - On client device, connect to the session via ssh / web (https).
For example, using the connection strings abovessh ro-tnLSDQsQD5W9SyqXJB3EaUAWQ@sfo2.tmate.io # Read only ssh sn6U6B4QAEehNAUznSu8Q2kSg@sfo2.tmate.io 
      
      
Leave a comment