Launch Byobu Automatically on Vagrant SSH

I can use SSH directly instead of Vagrant SSH command for interactive programs such as top or running tmux sessions. But I frequently just want to run Tmux or Byobu upon login. I can do:

1
$ ssh -F ssh-config vagrant -t byobu

But still too much trouble to go through all SSH configuration steps. So, I ended up with two-step process:

1
$ vagrant ssh

Now inside the guest machine, I immediately type:

1
$ byobu

To bring up new Tmux session or attach existing sessions.

Luckily, I just learned that I can collapse these two commands into a single one by enabling Byobu upon login. This is done by running the following command from the guest machine:

1
$ byobu-enable

This will add a line to your $HOME/.profile file which launches Byobu any time you login via SSH or a console:

1
_byobu_sourced=1 . /usr/bin/byobu-launch

If you need to run something other interactive process, we can disable the behavior from the guest machine:

1
$ byobu-disable

Another day another quick time saving trick.