socketstmuxshared

tmux shared socket throws "access not allowed" error


I am using tmux 3.3a on an Ubuntu 22.10 system with two users, bob and alice. Both users are members of the multiplexer group.

Bob has created a tmux session on an custom socket like so:

tmux -S /tmp/our_socket new -s our_session

and then changed the group of the socket file to multiplexer and added read/write permissions for that group:

chgrp multiplexer /tmp/our_socket
chmod g+rw /tmp/our_socket

Now alice, who is also a member of the multiplexer group, is trying to connect to this session using:

tmux -S /tmp/our_socket attach -t our_session

which throws an access not allowed error.

However when alice uses sudo-privileges, she is able to connect to the tmux session.

I do not understand why access is denied without elevated privileges, as the socket file has read/write permissions for the multiplexer group and both bob and alice are members of that group. My guess is, that it's connected to the sticky bit enabled for the /tmp directory, but I'm not sure.


Solution

  • I had a similar problem. It seems that the later versions of tmux have its own access check as well. So, in addition to making the socket accessible to the user you want to share the session with, you also need to tell tmux that this user is allowed.

    tmux server-access -a {user_to_share_with}
    

    For more info, see the description of tmux "server-access" command.

    P.S. As a bonus, the user can be allowed read-only access only now!