Introduction
Raspberry Pi VNC Remote Login is another way you can achieve remote control. VNC is a graphical desktop sharing system that allows you to remotely control the desktop interface of one computer (VNC Server) from another computer or mobile device (VNC Viewer). We’ll quickly go through the steps of setting this up.
Raspberry Pi VNC Setup
Very simple process. Install the latest VNC:
# sudo apt-get update # sudo apt-get install realvnc-vnc-server realvnc-vnc-viewer
Enable VNC Server:
# sudo raspi-config
Go to “Interfacing Options”:
check VNC -> Yes:
RaspPi is now ready 🙂
Eastablishing a Direct connection
Take your RaspPi IP address:
# ifconfig eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.47 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 ffff::bc37:ffff:fffd:af3d prefixlen 64 scopeid 0x20<link> ether b8:27:eb:fd:bb:3c txqueuelen 1000 (Ethernet) RX packets 584281 bytes 190287196 (181.4 MiB) RX errors 10 dropped 22 overruns 0 frame 0 TX packets 351963 bytes 394551142 (376.2 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Run VNCViewer (RealVNC, Windows in this case), enter IP address and hit enter:
You’re in. The system I used has a display in portrait mode, so don’t mind the height:
That’s basically it for Raspberry Pi VNC Remote Login. If you’re connecting from a non-RealVNC Viewer app, you might need to downgrade your VNC Server’s authentication scheme (set password unique to VNC Server). Open the /root/.vnc/config.d/vncserver-x11 config file:
Replace Authentication=SystemAuth with Authentication=VncAuth
To set a password, run:
# sudo vncpasswd -service
Restart VNC Server. You can create virtual desktop too. If you run:
# vncserver VNC(R) Server 6.2.1 (r32538) ARMv6 (Dec 1 2017 12:57:59) Copyright (C) 2002-2017 RealVNC Ltd. RealVNC and VNC are trademarks of RealVNC Ltd and are protected by trademark registrations and/or pending trademark applications in the European Union, United States of America and other jurisdictions. Protected by UK patent 2481870; US patent 8760366; EU patent 2652951. See https://www.realvnc.com for information on VNC. For third party acknowledgements see: https://www.realvnc.com/docs/6/foss.html xauth: file /root/.Xauthority does not exist On some distributions (in particular Red Hat), you may get a better experience by running vncserver-virtual in conjunction with the system Xorg server, rather than the old version built-in to Xvnc. More desktop environments and applications will likely be compatible. For more information on this alternative implementation, please see: https://www.realvnc.com/doclink/kb-546 Running applications in /etc/vnc/xstartup VNC Server catchphrase: "Aztec xray romeo. Fashion bikini taxes." signature: a3-5f-ac-73-c5-db-2d-10 Log file is /root/.vnc/raspberrypi:1.log New desktop is raspberrypi:1 (192.168.1.47:1)
We’ll end up with a new virtual desktop on 192.168.1.47:1. To destroy it, type:
# vncserver -kill :<display-number>
Conclusion
It’s relatively straightforward process, nothing complicated and it’s working just fine. Could you ask for more? I didn’t experiment much with other clients (Viewers), but I expect them to be the same. One disadvantage maybe with VNC. It’s mostly used when you need the control within the same network area (both computers on the same LAN). Of course, it’s not impossible to connect PC and RaspPi which reside in different networks, but it might require some port forwarding adjustments on your router or something more complex. Alternatively, you can setup a DMZ (demilitarized zone) on your router, which basically opens up that server/ip towards the world/internet. Easier, but more riskier.