tty-share

Terminal sharing over the Internet


Motivation

I wanted a very simple command line tool, that I could use to give remote access to my terminal session to somebody. Whether it was for a quick pair-programming, or for debugging, I wanted it to be extremely simple for the remote person to join the shared session. So I decided to start with using the browser for the remote end. The browser might not be the most friendly environment for a geek to type code, or shell commands, but it is something that everyone has - it’s present even in the most obscure Linux distributions. So I start it, I get a secret URL that I share with the remote person, they open it in the Browser, and that’s it: they have access to my shell session. And again, the important part is that this requires no setup on their machine - the web browser is all they need.

The gif below shows the very basic use-case, when the tty-share is launches bash and creates the session secret URL. The URL is opened in the browser, and the bash session is accessible from the Browser, anywhere over the Internet.

demo

Similar tools

VSC (Visual Studio Code) Live Share

I’ve tried Visual Studio Code sharing, and it seems to work relatively well. One big advantage is that both persons in the session can write code, and navigate independently of each other. It also supports terminal sharing.

However, the two disadvantages with this tool are the need of logging in with a Github (or Microsoft) account, and having to install Visual Studio Code on the remote side too. I don’t want to force the remote person to install VSC just for them to get access to a terminal session. Visual Studio Code might be popular in the web development circles, but it is not popular in the other development corners.

tmate.io

This is a great tool, and I used it quite a few times before. At the time I started my project, tmate.io didn’t have the option to join the session from the browser, and one had to use ssh. In most cases, ssh is not a problem at all - in fact it’s even preferred, but there are cases when you just don’t have easy access to an ssh client, e.g.: joining from a Windows machine, or from your smartphone. In the meantime, the project added some support for joining a terminal session in the browser too.

Perhaps one downside with tmate is that it comes with quite a few dependencies which can make your life complicated if you want to compile it for ARM, for example. Running it on my raspberry pi might not be as simple as you want it, unless you use Debian.


How to get it

Since it is written in GO, it compiles as a single static binary, which you can just download and run. No dependencies - just get the binary for your platform, from: https://github.com/elisescu/tty-share/releases.

It has a client side: tty-share - the tool that starts the shared session, and server side: tty-server - required to share the session over the Internet (outside the local network).

A server instances runs at tty-share.com, so you only need the tty-share binary to use it:

bash$ tty-share

Web terminal: https://go.tty-share.com/s/Vqp_to67Q8gMhOVTzZ_nP8TGjB_hzNu8kIT5IdZ1rqI=

Open-source

Both the command line tool, and the server side, are open-source. They can be found here, together with more information about how they work: https://github.com/elisescu/tty-share

Future work

Besides a few other things I think the tool should have, there are two major features I am thinking they would be useful:

End-to-end encryption

At the moment, the communication with the server is encrypted on both sides using TLS and https. But I would like to add end-to-end encryption, so not even the tty-server cannot read the messages send back and forth. The person starting the session will choose a password, that will be used to generate a shared key which will encrypt all messages from the tty-share to the browser application.

Persistent session

At the moment, the secret session URL is generated by the server, and it’s invalidated immediately after the session tty-share exits. It would be very useful to have that session persistent. The main use-case I have in mind is to be able to access my Raspberry Pi remotely, just by going to a secret URL, and to use the secret password I set for the end-to-end encrypted session. Even though my Raspberry Pi restarts, or is behind a NAT, whenever it reaches the Internet, and connects to that session, it will be accessible via the URL, from any browser (including the smartphone).

Contact

If you cared to try it, and have a question, or a problem with the tool, I would love to hear from you. Please create a Github issue: https://github.com/elisescu/tty-share/issues.

Credits