Use Raspberry Pi with VNC

I use Rasperry Pi to display Kibana on one of my screens. It is easy to manage Raspberry Pi through VNC just by running one script.

I also run UniFi Network Controller with Raspberry Pi

Raspberry Pi

Desktop autologin

Set Raspberry Pi to boot into desktop and with user pi without password

sudo raspi-config
  1. 3 Boot Options
  2. B1 Desktop / CLI
  3. B4 Desktop Autologin as ‘pi’ user

Install x11vnc

sudo apt update && sudo apt install x11vnc -y

http://www.karlrunge.com/x11vnc/

Auto hide cursor when not used

sudo apt install unclutter -y

Also i want screen to stay on all the time.

vi /home/pi/.config/autostart

@xset s off
@xset -dpms
@xset s noblank
@unclutter -idle 0

Client

Install VNC client

I use TigerVNC

sudo dnf install tigervnc

Copy SSH keys into Raspberry Pi

ssh-copy-id .ssh/YOURPUBLICKEY [email protected]

Connect with script

This script will open SSH tunnel into Raspberry Pi and start x11vnc server on Raspberry Pi and then open and connect TigerVNC.

vi raspberrypi-VNC.sh

#!/bin/bash
ssh -f -L 5900:localhost:5900 [email protected] 'sudo x11vnc -xkb -noxdamage -noxfixes -nopw -auth /home/pi/.Xauthority -display :0'
sleep 2
vncviewer localhost:5900
chmod +x raspberrypi-VNC.sh
./raspberrypi-VNC.sh

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.