I engage in quite a bit of troubleshooting and IT support for friends and family. A tool that has always made it easier for me to do this is tmate for terminal sharing. It is something akin to screen sharing, but on the terminal.
The major benefit with tmate is that I can bootstrap a quick entry into their system with ease and no effort on their part, while those interested could follow and troubleshoot their PCs along with me. Working with tmate is easy. Install on your favourite distro, then run:
The user should see a tmux session start with a handy dandy ssh command that looks something like this:
This would be the end of the tutorial and for all intents and purposes it is. Share this session with the other person and you are done, you have a two-way terminal sharing session.
But if like me and have always been greedy, then continue reading.
Self-Hosting a tmate-ssh-server instance
I decided to host my very own tmate-ssh-server. Why would one need to do so? I find for one, self-hosting fun and exciting while at the same time being reliable. The official default servers don't always run and are in some way or other rate-limited. So began my quest to run my own instance of tmate's ssh server.
If you'd be content with having a look at my docker-compose and calling it a day, then here's a link to it:
There's not much to it but three simple steps.
The next step is to key in what's special about your setup. You may enter the domain/IP to your server, whether it's behind a reverse proxy, ports, or more.
To explore and learn more about the environment variables in use, visit the docker hub page.
Create keys and start tmate-ssh-server:
Here, we use tmate's own script to create ssh-keys and mount them as a volume inside the docker image. My script lets you have a look at its contents before you run it. So, make sure everything is perfect and nothing is amiss.
As the script has run its course, it'll print the configuration necessary to use your tmate-ssh-server on a client. Save that in ~/.tmate.conf
file and share it with whomsoever would like to use your instance. docker-compose should have initialised tmate-ssh-server as a background service on a successful run of the script. Once everything looks good after having a look at the logs docker-compose logs -f
. Like earlier, run:
You now can share your new tmate instance hosted on your very own server!