Screen share with VNC
Sometimes it is not convenient to physically work with a device. Virtual Network Computing (VNC) allows you to control the desktop of one device from another.
VNC relies upon a client and a server. The client runs on a device you can physically interact with, such as a personal laptop, desktop, tablet, or phone. The server runs on your Raspberry Pi. When you use VNC, the client transmits keyboard and mouse events to the server. The server executes those events on your Raspberry Pi, and returns screen updates to the client.
The VNC client displays the desktop of your Raspberry Pi in a window. You can interact with the desktop as though you were working on the Raspberry Pi itself.
Raspberry Pi OS includes wayvnc. This provides a VNC server that you can enable in your device preferences.
Before you can use VNC on your Raspberry Pi, you must enable the VNC server.
Enable the VNC server
Raspberry Pi OS supports enabling the VNC server both graphically and at the command line.
When enabled, you can access your WayVNC configuration at /etc/wayvnc/.
|
Enable VNC Server Graphically
-
Boot into the graphical desktop on your Raspberry Pi.
-
Select the Raspberry Pi icon in the system tray of your desktop.
-
Select Preferences > Control Centre from the menu.
-
Navigate to the Interfaces tab.
-
Toggle the radio button next to VNC into the active position.
-
Select the OK button to save your configuration changes.
Enable the VNC server on the command line
Use raspi-config to enable the VNC server on the command line.
-
Open
raspi-configwith the following line:$ sudo raspi-config -
Navigate to Interface Options. Press
Enterto select. -
Select VNC. Press
Enterto select. -
Under Would you like the VNC Server to be enabled?, highlight
<Yes>and pressEnter. -
Press
Enterto return to the menu. PressEscto exitraspi-config.
Connect to a VNC server
To connect to your Raspberry Pi, you’ll need the following:
-
your Raspberry Pi and the device running the VNC client, connected to the same network (for example, a home wireless network or VPN)
-
the hostname or IP address of your Raspberry Pi
-
a valid username and password combination for an account on your Raspberry Pi
If you don’t know the IP address of your device, see our instructions on finding your IP address.
-
Download TigerVNC. You can install the latest version from the Releases page of their GitHub repository. Click on the link in the latest release, and find the binary for your platform. Windows users should download an
exe; macOS users should download thedmg; Linux users should install thejar. -
On your client device, launch TigerVNC. On macOS and Windows, you can double-click the binary. On Linux, install java with
sudo apt install default-jre, then runjava -jar VncViewer-<version>.jar, replacing the<version>placeholder with the version you downloaded. -
In the "VNC server" field, enter the IP address of your Raspberry Pi.
-
Click the "Options" button. Navigate to the "Input" tab. Check the box next to "Show dot when no cursor" to ensure that you can always see a cursor in TigerVNC.
-
Click the "Connect" button to initiate a connection with the server.
-
If TigerVNC warns you that the "Hostname does not match the server certificate", click the "Yes" button to continue.
-
If TigerVNC warns you that the "certificate has been signed by an unknown authority", click the "Yes" button to grant an exception for your Raspberry Pi.
-
-
When prompted for a username and password, enter your credentials.
-
Click the "OK" button to authenticate with the VNC server. If your credentials are correct, TigerVNC should open a window containing the desktop corresponding to your account on the Raspberry Pi. You should be able to use your mouse and keyboard to interact with the desktop and input text.