Running Headless: Accessing The Raspberry Pi GUI From A Remote Connection

If you are like me, you rarely, if ever, plug a monitor and keyboard into your Raspberry Pi. Instead you run everything from a network connection. Commonly this is just a terminal and SSH connection from a desktop computer like a PC or Mac. 

However, there are times when in it useful to access the Raspberry Pi Desktop and instead of reaching for the monitor, I instead reach for a tool called VNC - or Virtual Network Computer. In earlier days, you needed to install VNC on the Raspberry PI, but these days in 2020, it’s built-in. Like a lot of built-in tools you have to enable it first to use it.

I’ll describe below, how to enable VNC and connect to it from a remote computer. This whole setup can be done on the Raspberry Pi from the command line - after all, what’s the point if you couldn’t?

Enabling VNC on the Raspberry Pi  #

First of all  login to your Raspberry Pi over SSH. Then type the following command:

[crayon-5fc0be21b959a585285100/]

This will call up the Raspberry Pi command line version of the configuration screen.

Raspi-config home page

Then scroll down to “5 Interfacing Options” and the following screen comes up:

raspi-config Interfacing Options

Obviously the one we want here is “P3 VNC” and then enable it.

raspi-config enable VNC

It flashes to the command line and then returns with this screen:

raspi-config VNC Enabled

Then reboot and you are good to go.

Connecting to the Raspberry Pi from another Computer #

Once you have VNC enabled in the Raspberry Pi, then you need a VNC Viewer on the computer you want to use to view the Raspberry Pi. You can download the VNC Viewer for your platform from the RealVNC website (is there a FakeVNC website somewhere?). These days they want you to create an account - don’t worry you won’t get charged for anything - and then once you have you can download and install the VNC Viewer.

To connect to the Raspberry Pi you need to know the IP Address of your Raspberry Pi. Armed with that, the following steps shows how to connect to the Raspberry Pi. The screenshots are from a Mac, but the method is the same on other platforms.

Open up VNC Viewer on your computer and type in the IP address of your Raspberry Pi.

VNC Viewer Connect

When you first run it, you will get a message about authentication and certificate - just click OK, then you will get to the login screen:

VNC Viewer login to RPi

Initially (if you haven’t changed the default raspberry pi user and password) this will be “pi”and “raspberry”. The first time you log in you will see a very compact and bijou desktop of a whopping 720 x 480. You can easily change this.

VNC RPi Connection 720 x 480

Changing the Raspberry  Pi Desktop Resolution over VNC #

Cute though the initial desktop may be, it’s not very useful as a GUI. To change the resolution (and this will stick for when you next connect), go to the Raspberry Pi ->Preferences ->Raspberry Pi Configuration.

RPi Select Menu Configuration

Select the display tab and “Set Resolution” and set it to something that seems sensible to you.

RPI Set Display Resolution
RPI Set New Display Resolution

And then Reboot and VNC will automagically reconnect with the new resolution:

RPi VNC Auto-Reconnect

New connection and resolution :

RPi VNC New Resolution Desktop

Leave a Reply

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