简体   繁体   English

tmux 共享套接字抛出“不允许访问”错误

[英]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.我在Ubuntu 22.10系统上使用tmux 3.3a ,有两个用户,bob 和 alice。 Both users are members of the multiplexer group.两个用户都是multiplexer组的成员。

Bob has created a tmux session on an custom socket like so: Bob 在自定义套接字上创建了一个 tmux session,如下所示:

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:然后将套接字文件的组更改为multiplexer并为该组添加读/写权限:

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:现在,也是multiplexer组成员的爱丽丝正尝试使用以下方式连接到这个 session:

tmux -S /tmp/our_socket attach -t our_session

which throws an access not allowed error.这会引发access not allowed的错误。

However when alice uses sudo -privileges, she is able to connect to the tmux session.然而,当爱丽丝使用sudo -privileges 时,她能够连接到 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.我不明白为什么在没有提升权限的情况下拒绝访问,因为套接字文件对multiplexer组具有读/写权限,并且 bob 和 alice 都是该组的成员。 My guess is, that it's connected to the sticky bit enabled for the /tmp directory, but I'm not sure.我的猜测是,它连接到为/tmp目录启用的粘滞位,但我不确定。

I had a similar problem.我有一个类似的问题。 It seems that the later versions of tmux have its own access check as well.似乎更高版本的 tmux 也有自己的访问检查。 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.因此,除了让您想要共享 session 的用户可以访问套接字之外,您还需要告诉 tmux 该用户是允许的。

tmux server-access -a {user_to_share_with}

For more info, see the description of tmux "server-access" command.有关详细信息,请参阅 tmux“server-access”命令的说明。

PS As a bonus, the user can be allowed read-only access only now! PS 作为奖励,现在只能允许用户进行只读访问!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM