Remote Access with VNC on Raspbian

Virtual Network Computing (VNC) is a widely used remote technology, particularly in heterogenous networks.  For this reason, several open source VNC projects exist, including RealVNC and TightVNC.  VNC enables one to control a number of different computers from one keyboard.  It is different to a remote terminal session such as SSH as you do not log in to a server.  Anything you do on the VNC session is as if done by the user currently logged into the remote desktop.

VNC requires a client and server to create a session.  The server runs on the remote desktop and open a vncviewer on the client.  VNC estalishes remote access over either a local arean network or over the internet using TCP/IP, implementing a Remote Frame Buffer (RFB) which grabs the screen image and sends it to the client.  The client displays the remote screen in a window on the client desktop.  The client transmits mouse and keyboard data back to the server.

VNC creates stateless sessions, enabling the user to disconnect and reconnect from different machines irrespective of which operating system is installed on the client or server.

Security

However RFB does not travel over a normal connection in an encrypted mode.  Consider using OpenSSH and use VNC through an encrypted tunnel.

Raspberry Pi Specifics

The first time you run a VNC server it will prompt for a system password. The server will appear as hostname:1, hostname:2 etc.  The server chooses the first available display number and tells you what it is.  Setting the DISPLAY environment variable can cause applications to use a specified display.

RealVNC

As of September 2016, RealVNC software is available for free for academic and non-commercial use on Raspberry Pi’s.  Note that only one VNC server can be installed at one time.  So if you have installed tightVNC previously, you will need to remove it.

# remove tightvncserver
sudo dpkg -r tightnvncserver

# install realVNC 
curl -L -o VNC.tar.gz https://www.realvnc.com/download/binary/latest/debian/arm/
tar xvf VNC.tar.gz
# check the name of the file, it will look like
sudo dpkg -i VNC-Server-5.3.2-Linux-ARM.deb
# Raspberry Pi licensing automatically 

# configure raspi to start realVNC when powered up
sudo raspi-config
# select Advanced Options/VNC and set to yes

TightVNC

# install tightvncserver
sudo apt-get install tightvncserver
tightvncserver
New 'X' desktop is hostname:2
starting applications specified in /home/pi/.vnc/xstartup
Log file is /home/pi/.vnc/hostname:2.log
tightvncserver -kill :2

References:

Leave a Reply

Your email address will not be published. Required fields are marked *