The session was open, and every command ran with more access than it should. One slip, and the system was exposed.
Least privilege in tmux is not optional. It’s the only way to keep multi-user sessions from turning into a security hole. By default, tmux makes it easy to share a terminal, but it does not enforce fine-grained permissions. If several users attach to the same tmux session, they can often run any command, edit any file, and interrupt any process. That must change.
To implement least privilege in tmux, start with filesystem permissions and session ownership. Use tmux -S /path/to/socket with a socket file placed in a directory with strict chmod and chown settings. Limit access so only the intended user—or a specific group—can connect. If a socket is world-readable, any local user can attach to the running session.
Next, isolate processes with separate tmux servers for different tasks. One tmux server per role means one failure cannot compromise everything. For example, don’t run production operations from the same tmux server you use for development.