We have been trying to create numerous shared Tmux sessions for various games on our server. A quick google showed up with solutions such as:
tmux -S /tmp/game new -s game
chgrp game /tmp/game
# then connect via
tmux -S /tmp/game attach -t game
This worked for the first game, but of course the shell remained that of the user that started the tmux instance. So we created a new user for each game. We started the new tmux instance with:
sudo -u game tmux -S /tmp/game new -s game
That still worked, somehow, but it's getting sketchy. The problem we're facing now is starting a different shared instance to which people can connect via a game.sh
script.
Doing
sudo -u othergame tmux -S /tmp/othergame new -s othergame
basically exits and does nothing. Trying to connect to it just shows "failed to connect to server"
.
What are we doing wrong and, more importantly, is there some simpler way to do what we're trying to do?
tmux
does support shared sessions and AFAIK this is one of it's use-cases – NeilG May 22 '23 at 03:41