I have this scenario on a server

  1. userA (uid 1000) logs in over SSH and starts a tmux server and some sessions
  2. userB (uid 1001) logs in over SSH and runs su userA to become userA inside of a tmux session
  3. userB (as userA) now runs tmux ls or any other tmux command.
  4. The result is error connecting to /tmp/tmux-1001/default (Permission denied)

It's strange that the error hints at /tmp/tmux-1001/ which seems to be a tmux server for user id 1001 which is userB), whereas userA has uid 1000. So it seems that the tmux command run inside tmux attempts to connect to the wrong server.

When userB does their thing outside of tmux, there is no problem.

What is the reason for this?

1 Answer 1


tmux works out the socket by looking at the TMUX environment variable if it exists. You need to unset it when you switch user or use -S to point it to the socket directly.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .