kokoko3k / ssh-rdp

Real display ssh based remote desktop
GNU Lesser General Public License v3.0
143 stars 30 forks source link

[FEATURE-REQUEST] Allow to connect more than one user concurrently #20

Open adocampo opened 1 year ago

adocampo commented 1 year ago

Hello,

I expect you'll say no, as the user needs to be logged in remotely before they can connect remotely with ssh-rdp, but I was wondering if it would be possible to let more than one user to log into the same desktop.

Thank you.

kokoko3k commented 1 year ago

I don't even tried that. What happens when the second user tries to login? By gut feeling, i suspect it not to be funny, also, i think it sould be quite complicated if one dont want the poor gpu or cpu to encode the same picture twice...

Il giorno mer 19 apr 2023 alle ore 17:48 Angel Docampo < @.***> ha scritto:

Hello,

I expect you'll say no, as the user needs to be logged in remotely before they can connect remotely with ssh-rdp, but I was wondering if it would be possible to let more than one user to log into the same desktop.

Thank you.

— Reply to this email directly, view it on GitHub https://github.com/kokoko3k/ssh-rdp/issues/20, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJMPBXFE2HGQKTPAALDF33XCACODANCNFSM6AAAAAAXEITUVE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Antonio Orefice

Dipartimento di Biologia Lab. di Informatica Tel. Ufficio: 081/679305 - int. 79305 @.***

adocampo commented 1 year ago

In this screenshot, you can see what happens when I've just booted the remote computer. The first try with the user sysop returns an error, but after login in the remote machine (via vnc, hypervisor console, etc) it connects just fine. image

If I try to log in then with another user, the same error occurs image If I try anyway, ignoring the uinput warning, it fails as expected.

[WW] Remote user is missing R/W access to /dev/uinput
[WW] which is needed to forward input devices.
[WW] Do you want to continue anyway (not recommended) (y/n) ? y
[WW] Proceeding anyway...
[OK] Checked required executables

[..] Checking input devices...
[OK] Device ready       : Corsair CORSAIR K70 RGB PRO Mechanical Gaming Keyboard
     add event device for Corsair CORSAIR K70 RGB PRO Mechanical Gaming Keyboard: event7
     add event device for Corsair CORSAIR K70 RGB PRO Mechanical Gaming Keyboard: event8
[OK] Device ready       : SINOWEALTH Wired Gaming Mouse
     add event device for SINOWEALTH Wired Gaming Mouse: event4
     add event device for SINOWEALTH Wired Gaming Mouse: event5
[..] Reading hotkey file /home/malevolent/.config/ssh-rdp.input.hk.config
[OK] GRAB_HOTKEY=119
[OK] FULLSCREENSWITCH_HOTKEY=70

[..] Setting up input loop and forwarding devices
     forward input from device event7...
     forward input from device event8...
     forward input from device event4...
     forward input from device event5...

[..] Starting netevent daemon with script /tmp/nescript106065
added device mykbd1
added hotkey 1:119:0 for device 0
added on-'grab-changed' command
added hotkey 1:119:1 for device 0
added hotkey 1:70:0 for device 0
added hotkey 1:70:1 for device 0
added device dev2
added device dev3
added device dev4
added output myremote

[..] Trying to connect to angel.docampo@192.168.10.126:22
     and stream display :0
     with size AUTO and offset: +0,0

[..] Guessing audio capture device
ControlSocket /home/malevolent/.config/ssh-rdp106065 already exists, disabling multiplexing
ControlSocket /home/malevolent/.config/ssh-rdp106065 already exists, disabling multiplexing
error: error opening uinput device: Permission denied
interrupted
[WW] Guessed audio capture source: auto_null.monitor

[..] Guessing remote resolution
Invalid MIT-MAGIC-COOKIE-1 key
xdpyinfo:  unable to open display ":0.0".

[..] Start audio streaming...
[..] Start video streaming...
[file] Reading from stdin...
ControlSocket /home/malevolent/.config/ssh-rdp106065 already exists, disabling multiplexing
[NULL @ 0x558e1cddc5c0] Requested output format 'x11grab' is not a suitable output format
:0.0+0,0: Invalid argument
Failed to recognize file format.

Exiting... (Errors when loading file)
Guessed Channel Layout for Input Stream #0.0 : stereo
[aost#0:0/libopus @ 0x5606ca4fcac0] Finishing stream without any data written to it.
[nut @ 0x7f6868000c80] EOF before video frames
fd:: Invalid data found when processing input
interrupted
shutting down

If I logout the first user and login with the second user, then it works for the second user, but the first one cannot connect then, with the very same error.

So my bet is the udev rule assign the /dev/uinput to the first user it logs into the system (I think it makes sense, as a keyboard or gamepad can be hardly controlled by two users at the very same time, and a mouse would be even more impossible)

xenogenesi commented 5 months ago

Sorry for intruding, if I can make a couple of suggestions, the video should probably be transmitted over the network as a multicast (encoded once and transmitted to all clients that register with the multicast session), and a new pointer should probably be created on the server (xinput create), each user's events forwarded to the right pointer. However, the pointers could create some glitches (as happened to me), I don't know if there are video cards that manage multiple pointers in hardware, maybe there are also workarounds, I had only done some quick tests.

kokoko3k commented 5 months ago

You're welcome, i left the issue open because even if I don't see many use cases, maybe there is a simple solution that justifies its implementation.

As per the video, multicasting to ssh... how? I think that maybe the encoded stream could be duplicated to a fifo (mkfifo+tee?) and consumed by the second user for free, but this has to happen in a non blocking way. Also, there should be a way to track connected users.

Just ideas.

xenogenesi commented 5 months ago

As per the video, multicasting to ssh... how?

No, you're correct, that's not possible, but maybe that wasn't a requirement for the OP? ffmpeg should already support options for multicasting and I think it might be "relatively" simple to modify the current script to use multicast and play it.

I don't know if it is possible to implement a solution using fifo.

Maybe some solution with ffserver?