Innovate anywhere, anytime withruncode.io Your cloud-based dev studio.
Server Management

TMUX - Sharing Terminal between Users

2022-07-21

More Often you would've come across sharing screens with applications like Teamviewer, Windows Remote Desktop Connection or remmina (if you're a Linux user). But if you want to share only your terminal, you can look up to Tmux.

Installing Tmux:

apt-get update
apt-get install tmux

Starting a Tmux Session:

tmux new-session

This starts a new tmux session by default with a session-name 0. When you initialize a new session, will be 1 and so on. If you want to start a named session, the command would be

tmux new-session -s <session-name>

Connecting to existing session:

tmux attach -t <session-number>
tmux attach -t <session-name>

The above will only be possible if you're logged in as the same user as one sharing the session.

Using Sockets for different users to connect:

To Start a new session
tmux -S /tmp/socket

Change its permission for other users to access
chmod 777 /tmp/socket

for other users to attach to the session
tmux -S /tmp/socket attach