I'm using VNC Viewer in Windows to control the Raspberry Pi without screen but I need to get into the Raspberry Pi first by using putty software and then write the command code:

 $ vncserver

to create a server to be able to control the Pi with the VNC Viewer.

How can I run this automatically without code writing, how to configure it?

  • something like this, into start.sh file insert your command Jul 18, 2017 at 14:02
  • Which VNC Viewer? RealVnc is incompatible with most viewers. Do you intend to boot the Pi to GUI; if not tightvncserver is a better option, but setting either up on a headless system is non-trivial.
    – Milliways
    Jul 19, 2017 at 0:21
  • Here is the old way. Not sure if it is still necessary. learn.adafruit.com/…
    – SDsolar
    Nov 26, 2017 at 2:32

2 Answers 2


Simply enable the VNC server using raspi-config, and it will be started automatically during boot. Make sure to also set "boot to desktop", so that there's a GUI running to use with VNC. And use the official VNC client on Windows.

I'm doing this on a regular basis when I'm preparing new OS images for new projects: flash Raspbian image, create ssh file on boot partition, then headless boot, ssh into the Pi. Next, set hostname, change password, enable VNC. Reboot. Direct my VNC client (Android, Windows, ...) to the Pi using its newly set hostname (and correct domain for my home router).


You can use the RealVNC server provided by default with the Raspberry Pi OS, but you might face some issues.

In case you want to use tightvncserver and you want that to start at bootup, you can add these lines at the end of the .bashrc file.

sudo killall vncserver
vncserver -Authentication VncAuth :1

This is also sets the Authentication mode as VncAuth.

  • 1
    What issues might you face with the default server?
    – Chenmunka
    Mar 20, 2023 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.