Ubuntu – Use multiple byobu sessions, while ignoring unrelated tmux sessions

byobutmux

So, I have access to a shared shell account where other people and I do some work.

Some people prefer use tmux, so they have open their tmux sessions, loading config from ~/.tmux.conf. I prefer to use byobu wrapper around tmux, since it has much nicer keybindings and other stuff.

The problem is whenever there is a tmux session used by other people, whenever I run byobu it resumes their tmux session instead of creating a new byobu session for me.

So, I tried running byobu-tmux new-session, but then it starts a new tmux session using their config (from ~/.tmux.conf) instead of byobu.

How can I workaround that?

The tmux program is designed to be run as a single server process that manages one or more independent sessions. The configuration file is loaded by the server process when it starts and is applied to new sessions when they are created. Running tmux new-session (or, equivalently in this case, byobu new-session) contacts the running server if there is one, and requests that it create a new session. The server uses a known path for its socket based only on the UID of the user, and that is all that is needed to connect to a running tmux server. So this is why if a "normal" tmux session is already running, byobu will either attach to or create a new session using that server.

According to the tmux man page, you can simply change the socket used by tmux to start two independent tmux servers, each with their own sets of configuration if desired. You can either specify -L to change the base name of the socket or the -S option to specify a completely different path to the socket file. The default tmux socket is named default.

So, using these tmux options when calling byobu, to start an independent tmux server with byobu, you can run

byobu -L my-byobu new


or

byobu -L my-byobu attach


where the name my-byobu can be replaced with any name of your choice. This starts a new tmux server with the name my-byobu, which loads the byobu configuration for tmux instead of the default, and effectively creates an independent namespace for your byobu tmux sessions.