zellij-org / zellij

A terminal workspace with batteries included
https://zellij.dev
MIT License
21.13k stars 643 forks source link

How to start Multi-user session? #1287

Open elevaitleo opened 2 years ago

elevaitleo commented 2 years ago

Hey there, thank you so much for this tool, it really looks promising and solves exactly one of the problems we have right now: the ability to have a multi-user session with multiple cursors (unlike tmate.io which is really nice but has only one cursors forcing us to be super disciplined).

However, I was not able to start a "real" multi-user session, in the sense that different users on the same machine are able to attach or even see the same zellij session.

I downloaded the latest binary (0.26.1). Whenever one user starts a zellij session, the others users cannot see it via zellij ls and are not able to attach. Is this expected behavior? That is: should I create a single user on the machine for share zellij sessions (I would prefer if I didn't have to do it...)? Is there something that I should take care of?

Thanks in advance!

imsnif commented 2 years ago

Hey @elevaitleo ! I'm very happy to hear you're excited about this feature.

I totally get what you're saying about not wanting to have a specialized user, but for now you do have to all be logged into the same user. The reason for this is that having multiple users log into the same session is a bit of a security issue we're not too thrilled about (imagine being able to just move focus to another user's terminal pane and gain root access).

This isn't a hard decision though, and so it's good feedback to get. In general multiplayer sessions are a bit of a new feature, and so they might be a little rough around the edges. Any further feedback you have or bugs you find would be very welcome!

elevaitleo commented 2 years ago

Hey @imsnif , many thanks for the quick answer, at least I know what to do now :-) My issue with all users using the same account is about ssh keys: we typically use ssh to push and pull code and that means this "multiplayer-user" needs one private ssh key to be able to do so. In addition, the commits still need an author, and thus the "driver" would have to make the right configurations for git.

But I guess we can find some work-arounds. Any suggestions on the best practices or tips for multiplayer usage are very wellcome!

imsnif commented 2 years ago

Hum. That makes sense. I wonder if we can somehow limit the users in a session to a certain group - maybe that's the solution we actually want here?

As for multiplayer session tips, a short while ago we did a stream of a multiplayer session, you can check out the recording if you like: https://www.youtube.com/watch?v=G1iCXWJybvE

typetetris commented 2 years ago

If zellij operates like tmux (client and server, using a unix domain socket), you could just create the socket with 700 permissions in a known location. Now the user creating the socket can control, who can join. And he can later change the permissions again.

We are in the same situation like the issue author.

At the moment we use tmux and attach from our respective os users. If I want to "throw out" my colleagues, I just change the permissions on the socket and detach them.

Of course, they could have installed a trojaner/virus or something already. But for me it is more about privacy and not security, as I trust my colleagues generally.

alexandrestein commented 1 year ago

Hey,

Any update on this topic? I agree with @typetetris, I trust my colleagues generally speaking.

Socket seems a reasonable approach to me.

IIIzP0III commented 1 year ago

I would like to see a multi user session feature, for security reasons I suggest the approach like how screen operates it

by activating multi user mode inside the active session then giving users or groups permission to attach to it

:multiusersession on :adduser user1 user2 user3 :addgroup group1

bsima commented 1 year ago

Would love to see multiplayer in zellig.

If you want some prior art on how to accomplish this, look at wemux https://github.com/zolrath/wemux

It works basically how @typetetris described but with the edges smoothed out a bit.

Ktoks commented 4 months ago

I was under the impression that this was supposed to be a default feature. It is not working in Rhel 7 or Rhel 8 for different users logged onto the same system using zellij attach user1's session.

Zellij version 0.39.1. uname -r = 4.18.0-513.24.1.el8_9.x86_64

tlinford commented 4 months ago

I think this could mostly work by overriding $ZELLIJ_SOCKET_DIR and setting a directory that is accessible to each user. Otherwise sessions are stored per user in $XDG_RUNTIME_DIR.

Ktoks commented 4 months ago

I tried that using my account and root - I even went so far as to link the directories and set all of the zellij and xdg variables to match my account in root - nothing worked. I would love if it were usable for multiple users. Even if it was read-only for all but one - training folks would be MUCH easier!