6 months ago

VNC: Remote access a Raspberry Pi

Remote control your Raspberry Pi from another computer with VNC Server and Viewer

There will be times when you can’t or don’t want to switch to your Raspberry Pi. Perhaps you’re using another computer, or your Raspberry Pi is out of reach, behind your TV or a nest of cables. Fortunately, with VNC (Virtual Network Computing), free for non-commercial use and built into the Raspbian operating system, you can access the Pi remotely from any other computer, tablet, or smartphone on your network.

Get a free Pi Zero W, Official Case, and Accessories with your 12-month subscription to The MagPi. Click here for more info.

In this walkthrough, we’ll be using VNC Viewer to connect on the fly from one Raspberry Pi to another. If it’s something you’ll do frequently, set up a free RealVNC account and use this to sign in on up to five devices through the VNC Viewer. Doing so will save you entering their IP addresses in Step 3.

RealVNC produces clients for Linux (including Raspberry Pi), Windows, and macOS. Mac users can connect using macOS’s built-in tools. To do this, switch to the Finder by clicking the first icon on the Dock, then press COMMAND+K and enter vnc:// – replacing with your Raspberry Pi’s IP address (see Step 2). You’ll also need to change the authentication method on your Raspberry Pi by clicking the VNC button on the Raspbian toolbar, selecting ‘Options…’ from the menu, and setting Authentication to VNC password, as we’ve done in the screen grab below. Otherwise, install the client for your OS.

How to: Set up VNC in Raspbian

STEP-01 Enable VNC

Click the Raspberry Pi icon at the top-left of the screen and select Preferences > Raspberry Pi Configuration. Click the Interfaces tab, followed by the Enabled radio button beside VNC.

Enable VNC

STEP-02 Check your credentials

Click the VNC button that appears at the end of the menu bar and note down the four numbers that appear below Connectivity. These are your computer’s IP address on the network.

Check your credentials

STEP-03 Open VNC Viewer

If you’re connecting from another Raspberry Pi, switch to it, click the Raspberry Pi icon, and select VNC Viewer from the Internet submenu. Enter the IP address of your original machine. Otherwise, open it on your OS/computer of choice and enter the IP address there.

Open VNC Viewer

STEP-04 Optimise performance

If your remote Pi feels sluggish, hover at the top of the VNC Viewer window and click the cog on the menu that appears, then reduce the picture quality on the Options tab.

Optimise performance

STEP-05 Download files

Retrieve files from your remote Pi by clicking the horizontal buttons on the window’s drop-down menu, followed by the ‘Send files…’ button. Choose the files you want and click OK.

Download files

STEP-06 Upload files

To send files to your remote Raspberry Pi, click the menu bar’s VNC button, then the menu at the top of the new window. Choose ‘File Transfer…’ and select the files to transmit.

Upload files

Subscribe and never miss an issue

Get a free Pi Zero W with every twelve-month print subscription

Get a a brand new Raspberry Pi Zero W, a case for it, and a selection of adapter cables with a twelve-month print subscription to The MagPi!