How to Use VNC to Remotely Access Your Raspberry Pi from Other Devices « Null Byte :: WonderHowTo

With Virtual Network Computing, you don't need to carry a spare keyboard, mouse, or monitor to use yourheadless computer's full graphical user interface (GUI). Instead, you can connect remotely to it through any available computer or smartphone.Virtual Network Computing, better known as VNC, has been around for decades and can be used to control computers running a plethora of different operating systems including Windows, macOS, Linux, and even mobile platforms like Android.By using VNC, you are able to see and control the host machine's desktop from another remote device. In our guide, we'll be usinga headless Raspberry Pi with Kali Linuxas the host machine. VNC relays the keyboard and mouse functions from your device with an interface, like a laptop or smartphone, to the Raspberry Pi while issuing graphical screen updates back to the interface device. The end result is as though you were sitting behind the screen of your Pi, even if it's miles away.Don't Miss:How to Crack Weak Wi-Fi Passwords in Seconds with Airgeddon on Parrot OSThere are many reasons to use VNC to connect to a computer that doesn't come with its own screen or keyboard, such as our Kali Pi. A big reason is having discreet access to a Kali Linux box in environments where a smartphone may be the only tool you can visibly access.In ourKali Pi tutorial, we set up the ability to SSH into the Pi, but this doesn't allow us to runmulti-bash programs like Airgeddonwhich need to open multiple windows to function. Imagine easilycreating Evil Twin networksand wreaking wireless havoc on your iPhone while controlling the full Kali Linux GUI of a discreetly placed Raspberry Pi.This installation process will be similar across the various operating systems that support VNC, which is virtually all of them. In this tutorial, we will download and install the server portion of VNC on our headless Kali Pi, configure it to start at boot so we don't have to configure it each time, and finally install the VNC remote client on your laptop or smartphone you'll be controlling the Kali Pi through.RequirementsComputer orsmartphone:This will be the device you use to remotely connect to the Raspberry Pi.Power supply:The Raspberry Pi uses astandard Micro-USB power supplyfrom any typical phone charger.Ethernet cable(optional):This allows you to bypass wireless authentication by directly interfacing with local networks to which you have physical access.Local area network (LAN):This would be your router or modem if you are in a fixed position or your phone's wireless hotspot if you are mobile. In order for this to work, you need to be able to see your device on the same subnet, so ensure that the Raspberry Pi has an IP address and that you can ping. If you can't, it may mean you are not able to communicate with other devices on the network due to firewall or network settings.Step 1: Update the Headless Kali PiFirst, let's load up Kali on our headless Raspberry Pi. Connect to it eithervia SSH or by accessing it directly. We always want to run theapt-get updatecommand in a terminal window to ensure that all our dependencies are up to date and working properly. Make sure that the Pi and the device you are using to connect to the Pi are on the same wireless or wired local area network.Step 2: Install the VNC Server Software on the Kali PiThere are various versions of VNC, all with different purposes, but in this tutorial, we will be usingTightVNC, as it's well-supported, has plenty of documentation in the Raspberry Pi community, and easy to install on any version of Pi.Open a command window on your headless Raspberry Pi and typeapt-get install tightvncserver. This will download and install the software. When that is complete, typetightvncserver. This enables the TightVNC service, and it will require you to create a password to access your device from another computer. Go ahead and create one now. You should note that TightVNC can only set up to an 8-character password when selecting one.Once you enter a password, it will ask you "Would you like to enter a view-only password (y/n)?" PressN, because aview-only passwordwill only allow you to see what is displayed on the machine, but not to be able to control it.Don't Miss:How to Create Stronger PasswordsStep 3: Configure TightVNC Server on the Kali PiNow, to be able to access our Kali Pi remotely, we need to run TightVNC on it at boot. On our headless Kali Pi, we will navigate to the directory by typingcd /etc/init.d. Next, we want to create a startup script, so you can use whatever text editor you prefer, but I likeVim. If using Vim, typevim /etc/init.d/vncbootto create the startup script. Next, we want to insert the script below into the blank document.#!/bin/sh### BEGIN INIT INFO# Provides: vncboot# Required-Start: $remote_fs $syslog# Required-Stop: $remote_fs $syslog# Default-Start: 2 3 4 5# Default-Stop: 0 1 6# Short-Description: Start VNC Server at boot time# Description: Start VNC Server at boot time.### END INIT INFOUSER=rootHOME=/rootexport USER HOMEcase "$1" instart)echo "Starting VNC Server"#Insert your favoured settings for a VNC session/usr/bin/vncserver :0 -geometry 1280x800 -depth 16 -pixelformat rgb565;;stop)echo "Stopping VNC Server"/usr/bin/vncserver -kill :0;;*)echo "Usage: /etc/init.d/vncboot {start|stop}"exit 1;;esacexit 0Don't Miss:How to Use the Vim Text Editor in LinuxAfter all of that text is in place, we will save and quit by hitting theEsckey and typing:wq!. After the document is closed, we want to add permissions to this new startup script by typingchmod 755 /etc/init.d/vncboot. When that finishes, we want to add the dependencies to it by typingupdate-rc.d vncboot defaults.Reboot the Kali Pi, and the VNC module will be added to the startup boot sequence.Step 4: Download & Install the VNC ClientNow we can use any VNC client we want, but we are going to use RealVNC's "VNC Viewer" because it works on Linux, Android, and it's one of few that also works on Windows and iOS. You can download whichever version you wantfrom the RealVNC website. Once downloaded, install it like you would any other program. In this guide, I'll be using Windows.Step 5: Find the Kali Pi's IP AddressAfter installing the client software, we want to go back into our headless Kali Pi. Again, connect either bySSHing into it or accessing it directly, then open a terminal and typeifconfig. Write down the Kali Pi's local IP address; it should look something like "192.168.0.x."Step 6: Connect to the Kali Pi via Our ComputerNext, let's jump back into our Windows machine and open up the VNC Viewer app. The following directions may be different if you are using it on another operating system.In VNC Viewer, click the "File" option, and then click the "New Connection" tab. Now, let's add the Kali Pi's IP address to theVNC Serverfield. You can save this as any name that will help you remember this device in theNamefield. Press "OK" to finish and save the settings.Double-click on your new connection, and if successful, a window will pop up saying "The connection to this VNC server will not be encrypted." Because of this, it is not recommended to use this outside of your network if you are expecting privacy. Just press the "Continue" button. Another window will pop up asking for the password we created in the second step.Finally, bam! If the connection was successful, you should see a screen like the one below.Now we can work on our Kali Pi without the need to bring a separate keyboard, mouse, and monitor. These steps should be similar across the various operating systems RealVNC supports, but there will likely be small differences between the desktop and mobile versions. You can VNC into your Kali Pi any time both your Pi and the device you wish to control it with are on the same Wi-Fi or Ethernet local area network.If you want to do this on an iPhone, your display will look something like below.This is just one basic foundation of the toolset that compliments our hacking environment. In practice, VNC allows us to more quickly access our headless hacking computer from any device we have handy, allowing us to deploy Kali Linux tools in the most inconspicuous way possible.If you have any questions, you can leave a comment here or send a message on Twitter at@Nitroux2. And don't forget to stay connected and check out our social media accounts!Don't Miss:Turn Any Phone into a Hacking Super Weapon with the SonicFollow Null Byte onTwitter,Flipboard, andYouTubeFollow WonderHowTo onFacebook,Twitter,Pinterest, andFlipboardWant to start making money as a white hat hacker?Jump-start your hacking career with our2020 Premium Ethical Hacking Certification Training Bundlefrom the newNull Byte Shopand get over 60 hours of training from cybersecurity professionals.Buy Now (90% off) >Other worthwhile deals to check out:97% off The Ultimate 2021 White Hat Hacker Certification Bundle99% off The 2021 All-in-One Data Scientist Mega Bundle98% off The 2021 Premium Learn To Code Certification Bundle62% off MindMaster Mind Mapping Software: Perpetual LicenseCover photo and screenshots by Nitrous/Null ByteRelatedHow To:Discover & Attack Raspberry Pis Using Default Credentials with Rpi-hunterHow To:Build a Beginner Hacking Kit with the Raspberry Pi 3 Model B+How To:Set Up a Headless Raspberry Pi Hacking Platform Running Kali LinuxRaspberry Pi:Physical Backdoor Part 1The Hacks of Mr. Robot:How to Build a Hacking Raspberry PiHow To:Build a Portable Pen-Testing Pi BoxHow To:Run Windows 7 on a Nokia n900 SmartphoneHow To:Hack WPA WiFi Passwords by Cracking the WPS PINHow To:Share Wi-Fi Adapters Across a Network with Airserv-NgHow To:Lock Down Your DNS with a Pi-Hole to Avoid Trackers, Phishing Sites & MoreHow To:Set Up Network Implants with a Cheap SBC (Single-Board Computer)How To:Turn Any Phone into a Hacking Super Weapon with the SonicHow To:Enable Monitor Mode & Packet Injection on the Raspberry PiHow To:Log into Your Raspberry Pi Using a USB-to-TTL Serial CableHow To:Build a Pumpkin Pi — The Rogue AP & MITM Framework That Fits in Your PocketHow To:Load Kali Linux on the Raspberry Pi 4 for the Ultimate Miniature Hacking StationHow To:Build an Off-Grid Wi-Fi Voice Communication System with Android & Raspberry PiHow To:Automate Hacking on the Raspberry Pi with the USB Rubber DuckyRaspberry Pi:Hacking PlatformHow To:Set Up Kali Linux on the New $10 Raspberry Pi Zero WNews:Smart Home Proof of Concept Uses a Raspberry Pi to Control Air Conditioner with HoloLensOpen Sesame:Make Siri Open Your Garage Door via Raspberry PiHow To:Create a Wireless Spy Camera Using a Raspberry PiHow To:Boot Multiple Operating Systems on the Raspberry Pi with BerryBootHow To:Install VNC remotely on a Windows XP PCHow To:Remotely Control Computers Over VNC Securely with SSHMinecraft:Pi Edition, Coming Soon to a Raspberry Pi Near You