Skip to main content
typo fix
Source Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 263

It's kind of obvious with that last line, but the solution is to force a new server to run, even if it's the same user.

Use the option -S to specify a unix socket for tmux to run on (defaults to /tmp/tmux-`id -u $USER`/default)

So whenever you want to use a specific namespace (as your own user) I'd run

sudo ip netns exec $namespace sudo -u $USER tmux -S /tmp/$namespace.tmux $tmuxArguments

So long as you dontdon't exit any final session on a particular server, you can simply call tmux -S /tmp/$namespace.tmux $tmuxArgs (whether those args are a existingSession or new -s newSession) they will have shells running under the respective namespaces without sudo ip netns exec!

It's kind of obvious with that last line, but the solution is to force a new server to run, even if it's the same user.

Use the option -S to specify a unix socket for tmux to run on (defaults to /tmp/tmux-`id -u $USER`/default)

So whenever you want to use a specific namespace (as your own user) I'd run

sudo ip netns exec $namespace sudo -u $USER tmux -S /tmp/$namespace.tmux $tmuxArguments

So long as you dont exit any final session on a particular server, you can simply call tmux -S /tmp/$namespace.tmux $tmuxArgs (whether those args are a existingSession or new -s newSession) they will have shells running under the respective namespaces without sudo ip netns exec!

It's kind of obvious with that last line, but the solution is to force a new server to run, even if it's the same user.

Use the option -S to specify a unix socket for tmux to run on (defaults to /tmp/tmux-`id -u $USER`/default)

So whenever you want to use a specific namespace (as your own user) I'd run

sudo ip netns exec $namespace sudo -u $USER tmux -S /tmp/$namespace.tmux $tmuxArguments

So long as you don't exit any final session on a particular server, you can simply call tmux -S /tmp/$namespace.tmux $tmuxArgs (whether those args are a existingSession or new -s newSession) they will have shells running under the respective namespaces without sudo ip netns exec!

Source Link
Hashbrown
  • 214
  • 5
  • 11

It's kind of obvious with that last line, but the solution is to force a new server to run, even if it's the same user.

Use the option -S to specify a unix socket for tmux to run on (defaults to /tmp/tmux-`id -u $USER`/default)

So whenever you want to use a specific namespace (as your own user) I'd run

sudo ip netns exec $namespace sudo -u $USER tmux -S /tmp/$namespace.tmux $tmuxArguments

So long as you dont exit any final session on a particular server, you can simply call tmux -S /tmp/$namespace.tmux $tmuxArgs (whether those args are a existingSession or new -s newSession) they will have shells running under the respective namespaces without sudo ip netns exec!