I'm looking for a clean and easy way to share a tmux session with another user on the same machine. I've tried the -S socket-path
option, but it requires opening up all permissions of the socket-path before someone else can connect to the session. It works, but it's a little cumbersome. For example:
# Me
$ tmux -S /tmp/pair
$ chmod 777 /tmp/pair
# Another user
$ tmux -S /tmp/pair attach
This works, but both users now share the same tmux configuration (the configuration of the user who initiated the session). Is there a way to allow the two users to use their own tmux config and their own individual tmux key bindings?
For bonus points, ideally, it would also be nice to give read-only access of the tmux session to other users.
tmux detach
supports-E
that replaces the client with an arbitrary shell command. It doesn't matter if the target client runs under a different Unix user. So any user that can access/tmp/pair
can run arbitrary code replacing any attached client. The victim may not notice if you re-attach them fast enough:tmux -S /tmp/pair detach -t /dev/victim_tty -E '(malicious shell code) & exec tmux -S /tmp/pair attach'
– Kamil Maciorowski Nov 22 '19 at 18:27