This docker project is meant to make it easy to share a tmux session with others. It opens a port (default 999) that others can SSH into and automatically be part of your session.
- Install docker
- Install tmux
Clone this repo
git clone https://github.com/philsc/docker-tmux-guest.git cd docker-tmux-guest
Build docker image
docker build -t tmux-guest:latest .
Run the helper script to start up tmux, docker and connect the two together.
./run.sh
The helper script will print a bunch of information that you can use to share the tmux session with others.
Attach to the tmux session with the socket that was printed in the helper script. For example, if the helper script says that the tmux socket is located at
/tmp/tmp.abcdef/tmux-guest-port-999
then you can attach to the session like so:tmux -S /tmp/tmp.abcdef/tmux-guest-port-999 attach
Have others join your session by SSHing into the specified port as the
guest
user.ssh -p 999 guest@IPADDRESS
where you replace
IPADDRESS
above with the IP address of your machine.When you're done sharing the screen, simply disconnect from tmux and run the following command to kill the docker instance:
docker kill tmux-guest-port-999
The helper script will then kill the tmux session and cleanup the temporary files it had created.
This will only work on a Linux system with a sufficiently recent kernel. This is inherent to using docker.
The read-only guest sessions still have the authority to resize the tmux window. This is kind of annoying if you, the presenter, want to work with a certain minimum size. The only way to avoid this right now would be to manually re-compile tmux with the following change
diff --git a/resize.c b/resize.c index 5c365df..dab4508 100644 --- a/resize.c +++ b/resize.c @@ -58,7 +58,7 @@ recalculate_sizes(void) ssx = ssy = UINT_MAX; for (j = 0; j < ARRAY_LENGTH(&clients); j++) { c = ARRAY_ITEM(&clients, j); - if (c == NULL || c->flags & CLIENT_SUSPENDED) + if (c == NULL || c->flags & (CLIENT_SUSPENDED | CLIENT_READONLY)) continue; if (c->session == s) { if (c->tty.sx < ssx)
The vast majority of this work was originally inspired by the following article by Brian McKenna: http://brianmckenna.org/blog/guest_tmux