Configure VNC on Raspbian to remotely access the Pixel desktop of the Raspberry Pi

The Raspbian distribution supports the VNC remote desktop. It is very simple to set up and activate and does not require any technical skills to do it. The Raspberry Pi is an ideal platform for learning programming and electronics. You can recycle old computer equipment (screen, keyboard, mouse, SD card, 5V smartphone charger). The alternative is to access the Raspberry graphical desktop (called Pixel) remotely via a special connection called VNC which stands for Virtual Network Computing. To work, a VNC server must be installed on the Raspberry Pi, which will be responsible for managing the access rights, sending the screen image (like a video stream) and managing the user’s interactions. (keyboard mouse). If another computer (or why not a tablet or a smartphone), we will use a client (or Viewer).

Find the IP address of Raspberry Pi

You will need to know the address assigned by the router to the Raspberry Pi. To do this, open the Terminal and run the ifconfig command. Here, the RPI is at on the local network. Follow this tutorial if you need to assign a fixed IP address to your Raspberry Pi.

raspberry pi ifconfig domoticz adresse ip serveur

Configure VNC on Raspbian

VNC allows access to Raspbian’s graphical desktop from another computer and tablet. Open the Terminal and run raspi-config with the sudo raspi-config  command. Select Option 5 (Interfacing Option)

activate vnc raspbian raspberry pi

Then P3 VNC

activate vnc raspbian raspberry pi

The first time you activate VNC on the Raspbian distribution, you have to install all the necessary packages.

Accept the installation (O key) of the new packages. Raspbian takes care of everything, including installing the VNC server’s autostart script when the system boots.

Install a VNC viewer

There are many VNC clients for all platforms (macOS, Windows, Linux …) and for smartphones (iOS, Android …). RealVNC (website) is available on all platforms (including mobile). It is free for personal use. If you prefer to stay in 100% Open Source and free projects, pledge of privacy, you can turn to UltraVNC (official project page).

Go to the RealVNC site to retrieve the VNC viewer that matches your system.

telecharger realvnc vnc

Install and launch VNC Viewer on your computer.

In the address bar, enter the IP address of the Raspberry Pi (ifconfig command to find it) and confirm by pressing the Enter key on the keyboard. It is not necessary to specify port (5900) unless it has been manually changed.

adresse ip raspberry pi realvnc vnc viewer client

In the window that appears, enter your username and password.

connexion raspbian raspberrypi realvnc vnc

RealVNC informs you that the connection is not secure (it does not matter if you connect to the Raspberry Pi from a local network). Accept

realvnc alerte securite raspbian non securise

Here you are on your Raspberry Pi: D. There is nothing more to configure. VNC starts automatically when the system starts! Here, my Raspberry Pi 3 test that also runs a Jeedom home automation server.


TightVNC (official project page) is a lightweight VNC server that runs on all Linux distributions as well as on Windows. This is an alternative to RealVNC used by the Raspberry Foundation. It requires more settings and configuration than RealVNC. It’s up to you to choose the solution that suits you best. Turnkey or Power User.

To install and configure TightVNC, follow this tutorial written for Armbian on an Orange Pi also applies to Raspbian Stretch.

Secure (encrypt) VNC access

If you connect to your Raspberry Pi from your local network, the lack of SSL encryption is not required. Everything can be intercepted on the network. The video stream, the actions with the mouse, the keys of the keyboard … If security is your obsession or if you must regularly access your Raspberry Pi from the internet (from your work or your smartphone), it is wise and strongly advised to encrypt your exchanges with this one.

There are several methods:

  • Create an SSH tunnel into which the VNC stream will be injected. Follow this tutorial to set it up
  • Use VNC Connect from RealVNC. Follow this tutorial by François Mocq (in french)
Note. To access the Raspberry Pi from the internet, you will have to redirect the port to the IP address of the Raspberry Pi. VNC uses port 5900.

Add VNC access to a new user

If you need to add a new user to the system, it is necessary to configure a new output to the VNC server. To do this, simply open an SSH connection or Terminal and execute the vncserver command. Here for example, I added a user pi to Jeedom’s image.

By launching the vnc server, it automatically configures a new output. It is accessed by adding: 2 after the IP address

To go further, here are more tutorials on Raspbian that might interest you

Subscribe to the weekly newsletter

No spam and no other use will be made of your email. You can unsubscribe anytime.

DIY Projects