Is there a way to detach all terminals from a running
tmux session, except the one i'm actually using?
It seems a little weird, but the meaning of doing this is to keep some "persistency" layer to end user remote session, while ensuring that the user is using the system on only "one shell".
As explained here, it's easy to create sessions based on user names:
if [[ "$TMUX" == "" ]] && [[ "$SSH_CONNECTION" != "" ]]; then # Attempt to discover a detached session and attach # it, else create a new session WHOAMI=$(whoami) if tmux has-session -t $WHOAMI 2>/dev/null; then tmux -2 attach-session -t $WHOAMI else tmux -2 new-session -s $WHOAMI fi fi
But i want also, to make sure that the last attached terminal is the only one that remains attached to the user's
Does it have a way to accomplished that? I also accept solutions based on
screen (or other multiplexers) ;)