Saturday, 11 April 2020

VNC Viewer on macOS - Who knew ?

Whilst helping a colleague with a VNC-related question, I discovered that macOS has built-in support for VNC, via the Finder -> Connect to Server option.

VNC URLs look like this: -

vnc://192.168.1.19:5901

Alternatively, one can start the same VNC Viewer client from the command-line, via Terminal, and this command: -

open vnc://ubuntu:5901

For the record, I installed TigerVNC on my Ubuntu box: -

dpkg --list | grep tiger

ii  tigervnc-common                            1.7.0+dfsg-8ubuntu2                              amd64        Virtual network computing; Common software needed by servers
ii  tigervnc-standalone-server                 1.7.0+dfsg-8ubuntu2                              amd64        Standalone virtual network computing server

with this xstartup : -

cat ~/.vnc/xstartup 


#!/bin/sh

export XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &

gnome-session &
nautilus &

with the VNC Server's password encoded in: -

-rw------- 1 dave dave 8 Apr 10 15:19 /home/dave/.vnc/passwd

The thing that I initially missed, but then discovered, was that, by default, TigerVNC automatically starts assuming that all client connections will be local i.e. only from the box running the VNC Server itself !!!

This is easily mitigated when one starts the VNC Server: -

vncserver --localhost no

New 'ubuntu18:1 (dave)' desktop at :1 on machine ubuntu18

Starting applications specified in /home/dave/.vnc/xstartup
Log file is /home/dave/.vnc/ubuntu18:1.log

Use xtigervncviewer -SecurityTypes VncAuth,TLSVnc -passwd /home/dave/.vnc/passwd ubuntu18:1 to connect to the VNC server.


with the .PID file: -

cat ~/.vnc/ubuntu18\:1.pid 

7589

and the log file: -

cat ~/.vnc/ubuntu18\:1.log 

Xvnc TigerVNC 1.7.0 - built Dec  5 2017 09:25:01
Copyright (C) 1999-2016 TigerVNC Team and many others (see README.txt)
See http://www.tigervnc.org for information on TigerVNC.
Underlying X server release 11905000, The X.Org Foundation


Sat Apr 11 15:56:09 2020
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on all interface(s), port 5901
 vncext:      created VNC server for screen 0

For reference, this was a useful insight into TigerVNC

No comments:

Note to self - use kubectl to query images in a pod or deployment

In both cases, we use JSON ... For a deployment, we can do this: - kubectl get deployment foobar --namespace snafu --output jsonpath="{...