Skip to content

How to VNC into computers in Glen's lab

simondemeule edited this page Apr 3, 2023 · 2 revisions

Introduction

If you prefer not using SSH-based development tools (plain old terminal / VSCode / some other solution) and prefer using a graphical interface, you can instead interact with the machines through VNC.


Setup SSH access

First setup your SSH access with this guide.


Setup VNC server

Once your SSH access to the desired server is in place, you can setup the VNC server.

0.1 make sure the requirements are installed.

tightvncserver, xfce4, xfce4-goodies are required on the server for this setup to work; if typing them into a terminal yields a command not found, you need to install them. These should already be installed on green and blue. If not, sudo apt install them. When installing xfce4, choose gdm3 as the window manager.

0.2 do an initial run of the VNC server.

On the first run, launching the VNC server will ask you to setup a password, and generate some configuration files you will edit later. Type in:

vncserver

And setup a main password. You do not need a view-only password.

0.3 setup the VNC server config file.

Start by killing the server; the server needs to restart for changes to apply:

vncserver -kill :1

Here, :1 specifies we are killing window 1. Go to ~/.vnc, and use a text editor to add the following line to the very end of xstartup:

startxfce4

0.4 setup the SSH forwarding.

In order to connect to the VNC server, we will bridge traffic from the server to the client. This will need to be done every time you wish to connect to the VNC server. Use the following command to create the SSH tunnel (from the client):

ssh -L 5900:localhost:5901 -C -N $SSH_ALIAS_TO_LAB_MACHINE

This forwards port 5901 of the server to port 5900 of the client.

0.5 launch the VNC server.

Launch the VNC server in local mode using:

vncserver -localhost

0.6 connect using your VNC client.

Use the VNC client of your choice to connect to the machine. Tada!

If you are on macOS, you have a built-in VNC client you can access through Finder > Go > Connect to server > vnc://localhost.

Further reading

Much of this short guide was put together using information from this page.