On 1/9/24 20:05, David C. Rankin wrote:
On 1/8/24 12:39, Marc Chamberlin via openSUSE Users wrote:
I feel like I am starting to get above my pay grade now, there is not a lot of helpful information about "Rect" or how to configure, encode, or work with them. It seems that only an x11vnc guru can really deal with this part of the VNC model. Is there anyone on this mail list who can tackle this problem for me and help shed some light on what is going on? A command line example(s) like a picture is worth a thousand words! Much appreciate all offers of help and suggestions.

Marc...


Alright,

  It's not that bad, but making friends with how to set it up and how to forward the port so you are securely accessing the remote over ssh is a bit tricky.

  On the server you want to connect to. It must run vncserver. The computer you connect with runs vncviewer.

On Server To Connect To:

  You have to start vncserver the first time -- it will fail because there is no config and now user associate with your user. Just start it and let it ask you for a password and then let it crash or kill it. You will find you now have a ~/.vnc directory. In my directory (on the server hostname: 2pi that I connect to from openSUSE Leap 15.4) I have:

$ l .vnc
total 28
drwxr-xr-x  2 david david 4096 Mar 24  2020 .
drwx------ 41 david david 4096 Jan  9 21:33 ..
-rw-r--r--  1 david david 4499 Jan  9 21:33 2pi:1.log
-rw-r--r--  1 david david  323 May  7  2019 config
-rw-------  1 david david    8 May  7  2019 passwd
-rwxr-xr-x  1 david david  620 May  7  2019 xstartup

  The .log is just that, a log. The 'config' is the vncserver config: e.g.

$ cat .vnc/config
## Supported server options to pass to vncserver upon invocation can be listed
## in this file. See the following manpages for more: vncserver(1) Xvnc(1).
## Several common ones are shown below. Uncomment and modify to your liking.
##
securitytypes=vncauth,tlsvnc
desktop=stpdsktop
geometry=1440x864
localhost
alwaysshared

  The passwd file is just the encrypted password you typed when you started vncserver the first time and it prompted for one before crashing (delete it and it will ask again)

  The xstartup file tells vncserver which WM to start usually by sourcing ~/.xinitrc, just like when you type 'startx' if you don't have a DM enabled, e.g.

$ cat .vnc/xstartup
#!/bin/sh

unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
. /home/david/.xinitrc

  My .xinitrc is just your normal setup for startx. I just have it start fluxbox (you can have it start any desktop you want, but icewm, fluxbox, etc.. are instantaneously available and blistering fast). You can run full Plasma if you want. It doesn't really matter since you will start the server and it will already have the desktop running before you connect to it.

Hi David, Many thanks for your write up, I know that it took an effort to do so, and I am sure others will find it useful as well. Unfortunately I am not groking it and have a couple of questions of course. First of all, my systems don't seem to be using .xinitrc, instead the only related file I find in my home directories is some sort of template file called .xinitrc.template and the contents of it are very different from what you posted as your version of .xinitrc So I am not sure how to proceed with setting up vncserver. I did install it on some of my systems just to play around with it a bit, and it does start up at least but I have no way to test it yet.

Keep in mind also that the contents of my home directory may not be what is expected for OpenSuSE 15.4. I have /home in it's own partition and just keep remounting it as I upgrade from one version of OpenSuSE to the next. This has bought me problems in the past as the contents of the user configuration files in all the dot directories are sometimes incompatible with the newer version of OpenSuSE that I upgrade to. I don't know whether xinitrc is expected or is used even in OpenSuSE 15.4 but it seems to be working fine without it.



END OF CONFIG ON SERVER - Rest you can do on host.

What you do on your box you are connecting from:

  It's easy. What you want to do is simply forward the X-display port from the server to a local port on your openSUSE box. You ssh into the server and then simply start vncserver from the command line (it will throw up a little dialog asking for your password). Once you start vncserver, you can then connect to the display using vncviewer. Here are the details.

  You will setup up port forwarding and ssh into your server all with a single short command. The X display your are forwarding (usually display :1) runs on port 5901. X display :2 runs on port 5902, ... and so on. So you are simply forwarding port 5901 from the server to any port you like on your system (I usually use 9901 for the hell-of-it). To ssh into the server and forward port 5901 to my local port 9901 all I do is:

$ ssh 2pi -L 9901:localhost:5901

  Which just says grab port 5901 on the server an make it 9901 here. Now since you are ssh'ed into the server, just start vncserver from the terminal you just used to ssh in and port forward. I just do:

$ sudo systemctl start vncserver@:1.service

  That starts vncserver for display :1 on port 5901 (if you use :2, it will start display :2 on port 5902, etc..)

  Now just use the desktop run dialog, or another terminal to connect with vncviewer. REMEMBER you are connecting to your localhost because you already forwarded the display from the server to your box!!

  So all that is needed to launch vncviewer to connect to localhost port 9901 is:

$ vncviewer localhost:9901

I haven't gotten this far and set up vncviewer correctly but I do have a question. With x11vnc (and the reason I originally chose to use it was that) I am able to connect to display :0 which is the actual display that a user sees on his/her desktop at the remote "server" end of a vnc connection. This allows me to interact with what a remote user is actually seeing in real time. Doesn't connecting to other display ports cause a new login/xsession to be created? That doesn't seem to be what I want to do, and simply causes a new desktop to be created for the client which won't be the same as what a user at the remote server is seeing on their screen...

I have tried to fool around a little bit with vncviewer, but each time I tried to make a connection to display :0 on port 5900 I got told that that display port was already in use and got slapped away. But I am not sure about setting up and using vncserver without a .xinitrc file so my attempts may have been simply foolish because I am not sure about what I am doing exactly... LOL


  Presto! The remote desktop appears in the proper resolution you set in your ~/.vnc/config on the server, the desktop loaded through ~/.vnc/xstartup springs to life in front of you -- fully functional and blisteringly fast -- and it is all happening of a secure SSH encrypted session!  Life's good :)

  Give it a go. You will need to adjust how you start vncserver if the remote is using an init other than systemd, but you can so the same thing with init files.

  Report back if you get stumped, and don't forget to look at the ~/.vnc/xxx.log file and the journal on the server if things go south.


Consider me stumped and reporting back as directed. Sorry for my confusion, but again thanks for your help!   Marc