Connecting to your single board computer with VNC

Introduction
This is a short walkthrough for installing xtightvncserver on your small board computer running Debian GNU/Linux or a Debian derivative, so that you can connect a vncviewer and interact with the device's desktop remotely.

This tutorial was developed with an Olinuxino Lime2 single board computer running Debian 8. This is a tiny single-board ARM computer with a dual core processor suitable for light to medium loads. The Olinuxino was chosen because it supports using entirely free software (unlike some other single board computers). This device's uptime as of this writing should give some hint of its potential usefulness:

$ uptime
02:52:06 up 316 days, 16:33, 2 users, load average: 1.06, 1.14, 1.16

Though created with single board computers in mind, there's no reason that this process can't be used on any local or remote Debian or derivative system having an X server installed. For that matter, the process doesn't differ much for non-Debianish systems.

Recommended is reading the instructions through all the way before beginning. They're short.


Installing
SSH into your device for the installation. If you don't know its IP address, but you are pretty sure it's up and running (evidence from blinking lights on the device, for example), you can run a "quick scan" on Zenmap of your local network (for example, on 192.168.1.*).

Once at the shell prompt of your device, make sure that xtightvncserver is installed with the following command:

sudo apt install tightvncserver

You'll (probably) need to supply your password for sudo.

Starting the Server
To start the server, type

vncserver

at the shell prompt. Sample output:

New 'X' desktop is smallbox:1
Starting applications specified in /home/myusername/.vnc/xstartup
Log file is /home/myusername/.vnc/smallbox:1.log

The line about "New X desktop is smallbox:1" means that vncserver is running. Your device's hostname will appear in place of the word "smallbox".

Connect to your VNC session by running a vncviewer and connecting to 192.168.xxx.yyy:1 (fill in your IP address; the :1 is the session number from the message above.)

Stopping the VNC server
At the shell prompt of your single board computer, run the following command:

killall Xtightvnc

Note the capital "X". This will shut down all running VNC server processes.

Setting Your Password
When you run the vncserver for the first time, it will ask you to establish a password for VNC access.

$ vncserver

You will require a password to access your desktops.

Password:
Verify:
Would you like to enter a view-only password (y/n)? n
Creating default startup script /home/myusername/.vnc/xstartup


Changing your password(s)

One way to change the password(s) for the VNC server is to stop the VNC server, then delete the password configuration file with the commands below.

killall Xtightvnc ; rm ~/.vnc/passwd

The next time you run vncserver, it will ask for new password(s).

Troubleshooting your session

  • No menu? Try right-clicking on an empty area of the desktop for a menu.
  • Still no menu? You may need to look at your default startup script (its filename is ~/.vnc/xstartup ).

Sample xstartup (your configuration may differ slightly):

#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
export XKL_XMODMAP_DISABLE=1
/etc/X11/Xsession

Also see: Never Do This: How Not to Give a Single Board GNU/Linux PC a Static-y IP Address

Short tutorial, "Connecting to your single board computer with VNC". Originally written Tue Nov 28 12:29:49 EST 2017. Copyright 2017 J. Public. License: WTDHPL

Leave a Reply

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