Table of Contents
Tmate
Previously, I did a post on TMUX. It’s a great utility. If multiple users login to the same account, you can share the same terminal screen. This brings me to the point of this post.
Screen Sharing
If you need to share a screen for one reason or another, there are several popular programs you can use. Perhaps you are in a team of developers and need to collaborate on a project or get some help debugging a project. Maybe you are a systems administrator and need to screen share with a vendor. Historically, you would create a VPN account for the vendor and provide access. Recently, people have been using GotToMeeting, LogMeIn, Join.me, etc. If it’s only a Linux terminal you need to share, then you don’t need to share the full screen or create a VPN account, providing access to your network.
tmate
Now, there’s tmate. It’s a fork of tmux and they can both be installed and work on the same machine. It provides a secure, one-time connection to your box (as long as you close the session when you’re done). Once you establish the sesison, you can share the connection ID with anybody you want to share your screen with. You can share the connection ID was a number of people. I use this as a way to share the console with vendors. This way they only get access to the boxes they need to work on without sharing a full workstation screen. I can be working on other tasks while they’re looking around or researching on their end.
Installation
The maintainers have provided instructions for Mac OS X, Ubuntu, FreeBSD, and Gentoo. Just head to tmate.io and click the tab for your system. Alternatively, you can download the code and build it for your system.
Setup
Once you have it installed, you need to do a bit of setup. The tmate program establishes a secure SSH connection with tmate.io with the use of an SSH key pair. If you don’t know how to setup a key pair, head over to https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys–2. You don’t need step 3 (copying the key) for tmate, though. That’s all the setup you need. Easy!!
Using tmate
You can start it by simply typing tmate. It look just like a tmux session. In fact it is a tmux session with the benefit of sharing the session ID for others to connect. Now, the others sharing your session do not have to be on the same OS or network as you. They don’t even have to have tmate or tmux installed. They just need to connect.
As you can see from the above screen shot, the bottom line in green shows “ssh session” and a string of random characters. That’s the session ID you will give to others to connect. However, it will disappear after a short time. If it cleared before you could copy it, the use the following command.
tmate show-messages
This will show you all of the messages or session IDs.
Connecting Via SSH Sessions
Those that use an SSH session will also need to setup or use their existing SSH key pair. To use an existing key pair, type the following:
ssh -i ~/.ssh/id_rsa
In this session, the read only command would be:
ssh -i ~/.ssh/id_rsa ro-sYMETfGRcRvqMcvUdV2uhoQzA@sf2.tmate.io
The read write session would be:
ssh -i ~/.ssh/id_rsa 1Y35uUEXwrshy5JNGKu9FO8xR@sf2.tmate.io
Connecting Via Web Sessions
You may have noticed in the above screen shot that it shows web sessions. These are for people that don’t have a terminal or similar program installed or simply don’t want to use it. Don’t fret, they can use their web browser instead. Like the SSH sessions above, there are read only and read write session IDs.
Conclusion
The tmate utility allows for terminal sharing with the same settings as tmux. It allows you to share a terminal with coworkers and venders alike without compromising security. It’s a very useful tool that I use all the time.



