VNC, A Quick Introduction
When I started in tech, the command line was everything. You’d telnet (gasp!) or ssh into different systems and do your updates, upgrades and configurations. More and more systems now have a UI now, and not everything can be done via web page. So how do you remotely (and securely!) access those systems? If you weren’t aware of VNC, let me share a bit with you about it.
Back in November I was part of a virtual event where people were sent a Raspberry Pi to work with. I needed to boot a fresh system and automate various customizations, and then later to take screenshots for slides. These images were also needed for documentation. Sure, I could have walked over to my test bench every time. I could also have brought another keyboard or KVM to my regular desk. With VNC I was able to boot the new system, enable VNC with a single check box, then pull up the whole desktop on my regular work system. This allowed me to fill time between meetings with items I wanted to work on.
So what exactly is VNC? VNC stands for Virtual Network Computing. It is a virtual desktop-sharing system, that is to say it allows you to pull up the desktop from another system and use it just like you were sitting in front of it. There are variations, but I tend to use RealVNC.
The Server
The first part you need is to set up the VNC Server. You run this on the system you wish to connect to and control. The system can be headless (no monitor etc.) and normally the system uses TCP port 5900. So you might need to open up your firewall if you are running one.
The Client
The client creates a representation of the screen on the system you are connecting to. It also relays the commands (keyboard, mouse) that you leverage. The early versions had some intricacies around the mouse – you’d click on the client to bind the mouse and a specific key combination would “release” the mouse so you could interact with the desktop environment where you were running the Client from.
Security
Passwords are not sent in clear text (a la Telnet), but with some versions of VNC limit the password to 8 characters. Some will allow you to set a longer password – but truncate it! Either way someone could try a brute force attack.
Raspberry Pi
In the graphical desktop, go to Menu > Preferences > Raspberry Pi Configuration > Interfaces. You should see VNC in there. Toggle it to Enabled. Once you’ve done that, the server will be enabled every time you boot.
To connect to the system, you’ll need the IP address of your RPi, so you might want to go with a static address instead of DHCP.
If you aren’t running a GUI on the Pi, you can run the command vncserver. Write down the IP address and display number. Now you can enter it into VNC Viewer and you should be able to connect – provided you know a login and password for your system.