Solved VNC connections to macOS

grahamperrin

Daemon

Reaction score: 553
Messages: 1,782

When I last tried, a few months ago, none of the VNC clients on my FreeBSD computer could connect to VNC service on an adjacent iMac (macOS Catalina, 10.15.⋯).

I wasn't entirely surprised, because I had some trouble making VNC connections to Macs years ago. Probably long before I began using FreeBSD-based systems.

Can anyone suggest a known good client and a working recipe for the FreeBSD side of things?

(I'm not aware of doing anything wrong on the Mac side.)
 

kpedersen

Son of Beastie

Reaction score: 2,024
Messages: 2,897

Hi. me again ;)

Which VNC server are you using? The inbuilt Apple one or RealVNC?
If you temporarily turn off password and encryption, does it then connect? If so, the trick is to not use Apple's auth. Instead use VNC style passwords (preferably through an SSH tunnel):

40245209-3d8804ae-5ac5-11e8-85ea-0deaa8eb48a4.png


As for clients, I tend to stick with net/tigervnc-viewer. Mostly because it sends resize requests to Xvnc. (Though I don't think many other VNC servers can make use of that.)

However if you do prefer a really simple one or need to add a few hacks, like tying it to an internal authentication system, then the SDL vncviewer sample code is easy to compile and really handy.

Edit: Also, if you are not using RealVNC server for the mac; I highly recommend trying it. Whilst it is not "built-in" for free, it was so much faster. I used to use it for my mac mini build server and you could actually run 3D simulations with it quite happily.
 
OP
grahamperrin

grahamperrin

Daemon

Reaction score: 553
Messages: 1,782

With an ssh connection to the Mac, I configured VNC according to <https://apple.stackexchange.com/a/30239/8546> then shutdown -r now. Output from the configuration included:

Warning: macos 10.14 and later only allows control if Screen Sharing is enabled through System Preferences.

It's probably enabled, I can't tell for sure until next week. In the meantime, an adjacent Windows 10 computer on the same network can't make a connection with RealVNC.
 

kpedersen

Son of Beastie

Reaction score: 2,024
Messages: 2,897

With an ssh connection to the Mac, I configured VNC according to <https://apple.stackexchange.com/a/30239/8546> then shutdown -r now. Output from the configuration included:
It looks like Apple has an invalid "security feature" so that the only way to configure VNC is via the GUI. Very user friendly!

macOS also doesn't have anything flexible like X11 so you can't run a temp screen share tool like x11vnc or jrdesktop through ssh either.

So unless you have GUI access to it, it seems you can't 100% configure it via SSH anymore. If you can get access next week, it might be a little early days to consider installing the RealVNC server on it. Though going forward if you do need to administer a few of these, this might be a good idea.
 
OP
grahamperrin

grahamperrin

Daemon

Reaction score: 553
Messages: 1,782

Success (topic solved).

TightVNC works, however: its scroll bars are abnormal.

2021-07-19 15:24:00.png

FreeBSD bug 257280 – net/tightvnc scroll bar scrollers to not respond to click-and-drag

Remmina began working after I enabled TLS, which is strange because I would have tried TLS in the past. However:

2021-07-19 15:27:11.png
  1. it crashed when I remotely used macOS to scaled down the display (reduce the resolution) one step
  2. it crashed again when I remotely scaled down the display one step further, I could not regain control, restarting the Mac was not a workaround, it felt generally crashtastic.
Around this time, it was also impossible to regain control with TightVNC. Speeding through a transcript (below), these lines are remarkable:

Error: Shell widget vncviewer has zero width and/or height

If I recall correctly, things became more manageable after I ceased allowing macOS to scale the display.

Code:
% /usr/local/bin/vncviewer
Connected to RFB server, using protocol version 3.8
Performing standard VNC authentication
Authentication successful
Desktop name "mowa219-gjp4-m1"
VNC server default format:
  32 bits per pixel.
  Least significant byte first in each pixel.
  True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
Using default colormap which is TrueColor.  Pixel format:
  32 bits per pixel.
  Least significant byte first in each pixel.
  True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
% /usr/local/bin/vncviewer
Connected to RFB server, using protocol version 3.8
Performing standard VNC authentication
Authentication successful
Desktop name "mowa219-gjp4-m1"
VNC server default format:
  32 bits per pixel.
  Least significant byte first in each pixel.
  True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
Using default colormap which is TrueColor.  Pixel format:
  32 bits per pixel.
  Least significant byte first in each pixel.
  True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
CleanupXtErrorHandler called
Error: Shell widget vncviewer has zero width and/or height
% /usr/local/bin/vncviewer
^C
% /usr/local/bin/vncviewer
Connected to RFB server, using protocol version 3.8
Performing standard VNC authentication
Authentication successful
Desktop name "mowa219-gjp4-m1"
VNC server default format:
  32 bits per pixel.
  Least significant byte first in each pixel.
  True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
Using default colormap which is TrueColor.  Pixel format:
  32 bits per pixel.
  Least significant byte first in each pixel.
  True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
CleanupXtErrorHandler called
Error: Shell widget vncviewer has zero width and/or height
% /usr/local/bin/vncviewer mowa219-gjp4-m1
Connected to RFB server, using protocol version 3.8
Performing standard VNC authentication
Password:
Authentication successful
Desktop name "mowa219-gjp4-m1"
VNC server default format:
  32 bits per pixel.
  Least significant byte first in each pixel.
  True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
Using default colormap which is TrueColor.  Pixel format:
  32 bits per pixel.
  Least significant byte first in each pixel.
  True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
% /usr/local/bin/vncviewer mowa219-gjp4-m1
Connected to RFB server, using protocol version 3.8
Performing standard VNC authentication
Password:
Authentication successful
Desktop name "mowa219-gjp4-m1"
VNC server default format:
  32 bits per pixel.
  Least significant byte first in each pixel.
  True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
Using default colormap which is TrueColor.  Pixel format:
  32 bits per pixel.
  Least significant byte first in each pixel.
  True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
% /usr/local/bin/vncviewer mowa219-gjp4-m1
Connected to RFB server, using protocol version 3.8
Performing standard VNC authentication
Password:
Authentication successful
Desktop name "mowa219-gjp4-m1"
VNC server default format:
  32 bits per pixel.
  Least significant byte first in each pixel.
  True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
Using default colormap which is TrueColor.  Pixel format:
  32 bits per pixel.
  Least significant byte first in each pixel.
  True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
%

Warning: macos 10.14 and later only allows control if Screen Sharing is enabled through System Preferences.

Control also works after enabling remote management, which disables the (simpler) screen sharing option.
 

kpedersen

Son of Beastie

Reaction score: 2,024
Messages: 2,897

I believe the scrollbars are standard UNIX/X11 style. So you can click and drag with middle mouse button. Basically like XTerm.

Personally I find scrollbars awkward anyway and if not on a platform that can rescale properly (I don't think any macOS VNC server has this feature) then I just change the scale mode on the client so that the image itself simply gets rescaled. You can do this via F8 menu or as a command line argument.
 

kpedersen

Son of Beastie

Reaction score: 2,024
Messages: 2,897

I never see scroll bars in xterm, should I?
I think FreeBSD builds they default to off.

You can launch it with xterm -sb to turn them on. xterm +sb to turn them off.

You can also toggle it with one of the drop-down menus via ctrl-<mousebutton>.

Shift-pgup (or mouse scroll wheel) achieves the same. So really they are just visual clutter.
 

kpedersen

Son of Beastie

Reaction score: 2,024
Messages: 2,897

New to me :) however I can't see the option:
Heh, to be fair, as a big XTerm fan, I only found out about these menus many years after I started using it. I imagine many guys still don't know they exist.

It is ctrl and middle mouse click for that specific menu.

image-10.jpg


Not as awkward as requiring a middle-click when there's no middle-click.
Haha, perhaps. However, I thought most "modern" mice since the 90's had a scroll wheel that you can press down for middle click. I'm sure you can pick one up for £1.99 from ASDA ;)

Or: You can fall back to the left+right = middle emulation. This thread shows the X11 config. I personally haven't had to do this for over a decade however. I assume it is the same.

Can applications such as xterm be run in a way that allows scroll bars to be used with left-click?
Not that I know of. I know in the past I have tried to go the other way (Middle mouse to scroll) on Windows but it is unable to or was too inconsistent between programs. They are different operating systems after all. That is just how they do things.

Also, how have you pasted in X11 applications up until now? That is middle click. I suppose up until now you have only used Qt and Gtk's Win32 copy+paste emulation? Not that it is really a problem, only very specific programs are written using the underlying (X11/Win32/Cocoa) toolkits directly these days. The CDE desktop might not have made much sense however ;)
 
OP
grahamperrin

grahamperrin

Daemon

Reaction score: 553
Messages: 1,782

I'm almost sorry I asked …

… ctrl and middle mouse click …

So, I have left + right of a wide Kensington trackball mapped to middle click then I'm trying to scroll through the menu with the ball. Ugh!

On the plus side, I discovered that right-clicking on, above or below scroller moves it upwards.
… how have you pasted in X11 applications up until now? …

I always assumed that it wasn't possible to copy or paste in xterm. Ha.
 
Top