websockify icon indicating copy to clipboard operation
websockify copied to clipboard

websockify issue multiple user control one vnc server

Open king-dragon opened this issue 3 years ago • 7 comments

i am doing research on websockify but i am facing a problem i want multiple users to access my vnc independently but when i use the command

websockify -D \
     --web /usr/share/novnc/ \
     --cert /etc/ssl/novnc.pem\
     6081 \
     localhost:5901 \
     2>/dev/null

And accessing novnc from 2 different browsers to control vnc, it's like the same machine controlling 1 screen, is there any help when I access novnc from different machines they work independently?

After 2 days of researching, I think I can use token to do this but I don't know how to use websockify token can you help me

king-dragon avatar Jun 17 '22 11:06 king-dragon

Have you checked the wiki page about using tokens?

It's found here:

https://github.com/novnc/websockify/wiki/Token-based-target-selection

CendioOssman avatar Jun 20 '22 06:06 CendioOssman

Have you checked the wiki page about using tokens?

It's found here:

https://github.com/novnc/websockify/wiki/Token-based-target-selection

yes i have read it but i don't seem to fully understand this is the token file i created and this is the command i use

websockify -D \
    --verbose \
    --web /usr/share/novnc/ \
    --token-plugin=TokenFile \
    --token-source=/etc/websockify-token.cfg \
    6080
import memcache
import simplejson
class TokenMemc(object):
    def __init__(self, src):
        self._server = src
    def lookup(self, U6F7msdQ):
        client = memcache.Client([self._server], debug=0)
        stuff = client.get(U6F7msdQ)
        combo = simplejson.loads(stuff)
        pair = combo["34.82.215.8:5900"]
        return pair.split(':')

I used this url http://34.82.215.8:6080/vnc.html?resize=remote&path=novnc/websockify?token=U6F7msdQ this is the error i got CleanShot 2022-06-20 at 18 31 04

king-dragon avatar Jun 20 '22 11:06 king-dragon

I'm afraid you're mixing up sections. Please only look under the TokenFile Plugin heading and the example there. The Custom Plugins heading is for advanced usage where you write your own code. This assumes a familiarity with programming and is not for most users.

CendioOssman avatar Jun 21 '22 14:06 CendioOssman

I'm afraid you're mixing up sections. Please only look under the TokenFile Plugin heading and the example there. The Custom Plugins heading is for advanced usage where you write your own code. This assumes a familiarity with programming and is not for most users.

but i don't have target.config.d file

king-dragon avatar Jun 23 '22 06:06 king-dragon

That is something you'll have to create. websockify is not preconfigured for any tokens.

CendioOssman avatar Jun 23 '22 07:06 CendioOssman

That is something you'll have to create. websockify is not preconfigured for any tokens.

how do i make it can you be more specific

king-dragon avatar Jun 23 '22 12:06 king-dragon

That is something you'll have to create. websockify is not preconfigured for any tokens.

is my targt.config.d correct?

// my targt.config.d U6F7msdQ: 127.0.0.1:5900 1oJw2DwG: 127.0.0.1:5901

king-dragon avatar Jul 13 '22 14:07 king-dragon

Yes, that looks correct. Normally target.config.d will be a directory with multiple files, but it's also okay to just point directly towards a single file.

CendioOssman avatar Dec 22 '22 13:12 CendioOssman