Logout root after tmux detach

rootsutmux

I'm running tmux on my servers and when configuring things I like to just su into root and take care of things. Is there a possibilty to log out root automatically after I detach the tmux session?

Best Answer

sudo tmux attach connects you to an existing tmux session run by the root user. Once you detach the tmux session, the sudo command is done and you are back to the normal user.

Similarly, you can use sudo bash to get a root shell.

Related Topic