Guillaume Hérail

Ramblings in Frenglish

Session sharing with tmux

Posted on — Jan 17, 2021

One thing I’ve been using forever but even more since I started working from home is tmux session sharing.

tmux -S /tmp/shared

-S is telling tmux to use the following path as its socket

To share it with another user, you’ll need to change the permissions on that socket. The easy solution is just to open it up to everyone:

chmod 777 /tmp/shared

Though it would be wiser to selectively allow another user to attach your session. You can use ACLs for that, they are enabled by default on major distributions:

setfacl -m otheruser:rwx /tmp/shared

The other user can now just attach the session using the same option:

tmux -S /tmp/shared attach

Once done, make sure you close your tmux session and remove the socket. You don’t want to leave an open session around.

This is day 15/100 of #100DaysToOffLoad!