I just ran a short seminar where I used tmux to share a terminal with other users. It was quite effective. This posting describes how to set it up.
You need a shared ssh account that you’re willing to allow the other participants to log into. I set up a new account with a default password, and opened up the firewall ports to allow ssh in. By the way, I doubt this is very secure, so this may not be suitable for seminars with untrusted users.
In your standard account (not the shared one), run tmux like this:
tmux -S /tmp/shared
/tmp/shared is the shared tmux socket that the shared account users will connect to. It is created with restricted permissions, so you have to also do this:
chmod 777 /tmp/shared
Now I changed the shared account’s shell (in
/etc/passwd) to point to a script called
/home/shared/run-tmux which contains:
#!/bin/sh - exec /usr/bin/tmux -S /tmp/shared attach -r
When the shared user logs in, they will immediately be attached, read-only (-r), to the shared tmux session. I also had to make this script owned by root, unwritable, and had to give it an SELinux label so that sshd could run it:
chown root.root /home/shared/run-tmux chmod 0555 /home/shared/run-tmux chcon system_u:object_r:bin_t:s0 /home/shared/run-tmux
Seminar users now ssh to the shared account, and see the shared screen:
The only peculiarity of tmux is that it resizes the window area to the size of the smallest client, even for read-only clients. Thus if any client makes their windows smaller, you see this:
There is probably some tmux configuration to avoid this, but I couldn’t immediately see it.