Download PDF View on YouTube

Want remote access to your Raspberry Pi board? Today, we will examine three methods of running your Pi remotely.

Introduction

You can build an incredible number of projects with a Raspberry Pi microcomputer. New project plans are released daily. A Raspberry Pi can operate as a web server; it can be a remote environment sensor or become an effective network firewall to prevent evil operators from accessing your home network.

However, unlike a microcontroller, a microcomputer like the Raspberry Pi usually requires a keyboard, mouse, and monitor to function. This is fine in some cases, such as when using a Raspberry Pi as a home computer. However, for applications like web servers and firewalls, a monitor, keyboard, and mouse are only used during setup. Some applications, such as Python programs, don’t even require the mouse as they are all command-line-driven.

Of course, you can set up your Pi with a monitor, keyboard, and mouse and then unplug those peripherals when you are done. But how do you handle upgrades or troubleshooting?

Remote access is the answer. With a remote access system, you can use another computer to access the command line or even the entire GUI screen. 

Today, we will examine three methods for effectively and securely accessing your Raspberry Pi remotely.

Raspberry Pi Networking & Remote Access

We will be working with Raspberry Pi microcomputers, not a microcontroller like the Pico.  Not every method shown will work with every Raspberry Pi board.

Obviously, the board chosen will have to be able to connect to a network using a wired Ethernet cable or a wireless Wi-Fi connection.  So, this leaves out many of the earlier Raspberry Pi models.

In addition, one method requires the latest version of the Raspberry Pi Operating System to use every feature. Fortunately, every Raspberry Pi can run this OS.

Your Raspberry Pi connects to the network using TCP/IP (Transmission Control Protocol/Internet Protocol). It will be assigned an IP Address, a unique address on its local area network (LAN).  While you can assign a fixed IP address to the board, in most cases, you’ll use DHCP (Dynamic Host Control Protocol) to have the address automatically assigned to your Pi. In most home networks, the DHCP server is inside your router.

Two of the methods we will discuss require you to know your IP address. More on that in a bit.

Your Raspberry Pi also comes with default usernames and passwords (like “pi” and “raspberry”). These are well-known and should be changed immediately for security purposes.

Pi Boards

Here is a list of all the Raspberry Pi boards with networking capabilities:

Raspberry Pi 5

  • Wi-Fi: 802.11ac
  • Ethernet: Gigabit

Raspberry Pi 4 Model B

  • Wi-Fi: 802.11ac
  • Ethernet: Gigabit

Raspberry Pi 3 Model B+

  • Wi-Fi: 802.11ac
  • Ethernet: 300 Mbps

Raspberry Pi 3 Model B

  • Wi-Fi: 802.11n
  • Ethernet: 10/100 Mbps

Raspberry Pi Zero W

  • Wi-Fi: 802.11n
  • Ethernet: Requires USB Ethernet adapter

Raspberry Pi Zero WH

  • Wi-Fi: 802.11n
  • Ethernet: Requires USB Ethernet adapter

Raspberry Pi 2 Model B

  • Ethernet: 10/100 Mbps
  • Wi-Fi: Requires USB Wi-Fi adapter

Raspberry Pi Model B+

  • Ethernet: 10/100 Mbps
  • Wi-Fi: Requires USB Wi-Fi adapter

The demonstrations performed in the video accompanying this article use a Raspberry Pi 5 board.

Finding your IP Address

Two of the remote access methods we will use today require you to know your Raspberry Pi’s IP address. There are many ways to find this information.

Keep in mind that a Raspberry Pi with an Ethernet and Wi-Fi connection will have two IP addresses. When connecting with a method that requires an IP address, you will need to consider which network your client is on so that you can connect to the correct adapter. When given the choice, you will get better performance with the hardwired Ethernet connection.

Using the GUI

One of the simplest ways to determine your IP address is to hover your mouse over the network icon in the system tray. A tooltip will display the IP address of one or both network adapters.

Using the Command Line

You can also find your Raspberry Pi IP address using the command line.  Type the following command:

hostname -I

This will print the IP address of your network adapter(s).

Checking your Router

If you need to determine the IP address of a Raspberry Pi without a monitor and/or keyboard attached, you can look in your router’s list of connected devices.

Every router has a different configuration screen, so providing exact instructions for doing this would be impossible. On many routers, you’ll find a list of connected devices under the heading “DHCP Clients” or something similar.

Once you find the list, you’ll likely recognize many of your connected devices, such as printers or computers. Through the process of elimination, you should be able to spot the Raspberry Pi.

Once you’ve determined the IP address of your Raspberry Pi we are ready to establish a remote connection.

Remote Access Method 1 – SSH

SSH, or Secure Shell, is a protocol for securely accessing and managing devices over a network. We can use SSH to connect with the Raspberry Pi and get command-line access using a terminal.

When you use SSH, you open a secure channel between your computer and the Raspberry Pi. SSH uses public-key cryptography for authentication, ensuring that only authorized users can gain access.

SSH creates a “tunnel” within which data can be transmitted for security. Tunneling allows data packets to cross networks they wouldn’t normally traverse. 

SSH Setup

SSH is disabled by default on the Raspberry Pi.  It can be easily enabled as follows:

  • Boot up and log into the Raspberry Pi.
  • Click on the Raspberry Pi icon.
  • Click on the Preferences menu.
  • Select Raspberry Pi Configuration.
  • Select the Interfaces tab.
  • Select Enabled next to SSH.
  • Click OK

You can also enable SSH on a new Raspberry Pi OS installation when you flash the microSD card with the Raspberry Pi Imager.  In the OS Customization step, navigate to the Services tab.  Click the checkbox for Enable SSH.

Terminal Applications

To connect to your SSH-enabled Raspberry Pi, you will need a terminal application on your computer. Many terminal programs are available for any operating system. 

Here is an (incomplete) list of some popular terminal applications:

Windows

  • PuTTY – A free and open-source terminal emulator that supports various network protocols, including SSH.
  • MobaXterm – An advanced terminal with an SSH client, network tools, and a lot of additional features.
  • Bitvise SSH Client – A powerful SSH client with SFTP and SCP file transfer capabilities.
  • Windows Terminal – A modern terminal application by Microsoft that supports SSH through built-in integration.
  • Cmder – An open-source terminal emulator that provides an interface for SSH connections.

macOS

  • Terminal – The default terminal application in macOS, which includes a built-in SSH client.
  • iTerm2 – A powerful replacement for Terminal with many additional features like split panes, hotkeys, and a robust search.
  • Royal TSX – A versatile terminal that supports SSH and is known for its management and automation capabilities.
  • Termius – A cross-platform SSH client with a modern user interface and synchronization features.

Linux

  • GNOME Terminal – The default terminal for GNOME-based Linux distributions, with built-in SSH support.
  • Konsole – The terminal emulator for KDE environments, also supporting SSH.
  • Tilix – A tiling terminal emulator that supports SSH and offers features like split views and custom layouts.
  • Terminator – A terminal emulator that allows multiple terminal windows in one window and supports SSH.
  • Alacritty – A fast, GPU-accelerated terminal emulator that supports SSH.

Using SSH

Once you have a terminal application and have enabled SSH on your Raspberry Pi, we are ready to connect.

Open the terminal application on your computer and type the following at the command prompt (replace <ip address> with your Pi’s IP Address):

ssh <username>@<ip address>

If all is working properly you should see a security message. This message will only be displayed the first time you establish a connection. Enter “yes” to continue.

You should be prompted to enter your Rasberry Pi account login password.  You will then see the Raspberry Pi command prompt.

You can now use the command line just as you could directly on the Raspberry Pi.  

Raspberry Pi Command Line

Using the command line, you can do almost everything you can with a GUI.  Here are a few popular commands:

Navigation

  • cd: Change directory (i.e cd Documents)
  • pwd: Print working directory 
  • ls: List files and directories in the current directory

File Management

  • mkdir: Make a new directory (i.e mkdir MyFolder)
  • rm: Remove a file or directory (i.e rm myfile.txt)
  • cp: Copy a file (i.e cp myfile.txt MyFolder)
  • mv: Move or rename a file (i.e mv myfile.txt MyFolder)

System Information

  • uname -a: Show system information
  • cat /etc/os-release: Show OS version and name
  • hostname -I: Show IP address of the Raspberry Pi

Process Management

  • ps: Show running processes
  • top: Show running processes with detailed information
  • kill: Stop a running process (i.e kill 1234)

Package Management

  • sudo apt-get update: Update package list
  • sudo apt-get install: Install a package (i.e sudo apt-get install python3)
  • sudo apt-get remove: Remove a package (i.e sudo apt-get remove python3)

Misc

  • man: Show manual for a command or function (i.e man cd)
  • echo: Output text to the screen (i.e echo “Hello World!”)
  • sudo: Run a command with superuser privileges (i.e. sudo apt-get install python3)

Remote Access Method 2 – VNC

While you can perform many tasks using just a command line, there are times when only a GUI desktop will do. Rather than hooking a monitor, keyboard, and mouse directly to a Raspberry Pi, you can use VNC to run and display everything remotely.

VNC, or Virtual Network Computing, is a system that uses both a client and server.  You will run the server on the Raspberry Pi and the client on your Windows, macOS, or Linux computer. The client transmits mouse and keyboard events to the server. Operations are performed on the Raspberry Pi, and the resulting screens are sent to the client.  From the client’s perspective, you are directly running the Raspberry Pi.

VNC uses the RFB or Remote Framebuffer protocol. Since this does not provide encryption, a TLS (Transport Layer Security) layer is often added to the data frame.

VNC Setup

As with SSH, you can set up the VNC on the Raspberry Pi using the desktop GUI.

  • Boot up and log into the Raspberry Pi.
  • Click on the Raspberry Pi icon.
  • Click on the Preferences menu.
  • Select Raspberry Pi Configuration.
  • Select the Interfaces tab.
  • Select Enabled next to VNC.
  • Click OK

VNC Client

You must install and configure a VNC Client application on the workstation you wish to use for remote access. Not every VNC client will work with the Raspberry Pi VNC.

Raspberry Pi recommends TigerVNC as a VNC client. This free, open-source client is available for Linux, Windows, and Intel-based macOS devices. While Windows and Mac users can just double-click the installation file, Linux users will need to install the Java Runtime to use this client.

You CAN use the RealVNC client for newer Mac Silicon devices (i.e. M1, M2, M3, or M4). However, this has a couple of disadvantages:

  • It is a paid product.
  • It does not perform very well (users report sluggish performance).
  • It requires some modifications to the Raspberry Pi.

I recommend that Silicon Mac users use Raspberry Pi Connect instead of VNC for remote access. I’ll be showing you how to do that in a moment.

Using VNC

Power up both the Raspberry Pi and the client computer. Open TigerVNC.

You will be presented with a dialog window for the VNC Viewer. In the VNC Server field, enter the IP address of the target Raspberry Pi.

Now click the Options button. This produces a tabbed dialog box. Select the Input tab, and click the checkbox for “Show dot when no cursor”.  Click OK when done.

Next, click the Connect button. This should establish a connection with the server.

The first time you do this, you may receive a message saying the “Hostname does not match the server certificate”.  If you get this message, just click Yes to continue.

You may get a second message warning that the “certificate has been signed by an unknown authority.” If this happens, just click the Yes button to add an exception for the Raspberry Pi.

Finally, you will arrive at a login screen. Enter your login credentials, and you should be connected to the Raspberry Pi desktop.  You can now operate your Raspberry Pi exactly as you could if you were directly connected.

Method 3 – Raspberry Pi Connect & Connect Lite

The third and newest remote access method is Raspberry Pi Connect. This product allows you to establish a remote desktop connection over your local area network or the Internet.  With the Connect Lite version, you can get a remote Terminal session.

Connect provides a secure encrypted connection without the need to determine the Raspberry Pi IP address. No special client is required; Connect simply uses a web browser. Since it is browser-based, you can use Connect with any type of computer or mobile device.  Raspberry Pi Connect uses peer-to-peer WebRTC for communications.

By default, Connect communicates directly between your Raspberry Pi board and your web browser. If a direct connection cannot be established, traffic is relayed through a relay server based in London.

Connect can provide two types of remote access:

  • Screen Share – This is a full GUI screen that opens in its own browser window. Works a lot like VNC.
  • Remote Shell – Terminal access, just like SSH.  Also opens in its own browser window.

 You can use both forms of access simultaneously.

Raspberry Pi Connect Setup

In order to use Raspberry Pi Connect, you must be running the 64-bit version of Bookworm, the latest Raspberry Pi operating system.

Raspberry Pi Connect is activated in the Configuration panel, just like SSH and VNC. It is enabled by default in new installations.

Once installed, you will see a light grey “circle” icon on your Pi desktop system tray. This is the Connect icon.

Installing Raspberry Pi Connect Manually

On older versions of Bookworm, you can use the Terminal to install Raspberry Pi Connect.  We will start with an update and upgrade, which is always a good idea when installing new applications:

sudo apt update

sudo apt upgrade

Now you can install Connect:

sudo apt install rpi-connect

Once Connect has been installed, you will need to reboot.  Either use the GUI to restart the system or type the following at the command line:

sudo reboot

Connect will automatically start when you log in to the Raspberry Pi.

Registering your Raspberry Pi board

You need to register your Raspberry Pi in order to use Connect.

First, you will need a Raspberry Pi ID. If you haven’t set one up yet, you can do it here. To set up Connect, you’ll also need a monitor, keyboard, and mouse. Once it is all set, you can disconnect these peripherals.

When you log in to the Raspberry Pi, you will notice a new circular icon on your system tray. Click the Connect icon. You’ll be asked to sign in with a Raspberry Pi ID, and once you do, you’ll be asked to provide a name for your board. Give it a unique name that means something to you.

Once you have done this, the board will be registered on the Connect server. You can now get remote access using Raspberry Pi Connect.

Using Raspberry Pi Connect

Using Raspberry Pi Connect is very simple.

You can use a web browser on any Internet-connected computer to visit the Connect Web Portal. Sign in to the portal using your Raspberry Pi ID, and you should see the Raspberry Pi(s) you have with Connect installed. Select one, and you’ll be able to control it remotely.

Using the Connect Via button, you can select which type of connection (GUI or Terminal) you want. 

 If you select Screen Share, you will get a complete desktop GUI with the full Connect product running on the remote Raspberry Pi. This is the same session that is currently logged in to the Pi, so any open windows will appear in both sessions.

This means that the remote Raspberry Pi must have an active desktop session to attach to using Pi Connect. A desktop session usually starts when you power up or reboot the Pi, so this isn’t generally a concern. 

If you have a case in which your Pi does not automatically log into a desktop session, you can run this command in the Terminal:

oginctl enable-linger

This enables “user lingering” and will allow Connect to run even when you are not logged into the Raspberry Pi.

Beta Software

As of this writing, Connect is still beta software, so it may be buggy. Users have reported sluggish operation when sent through the relay server in the UK.  For users using multiple displays, there is currently no method of switching to the second one.

However, considering ease of use, Raspberry Pi Connect is the easiest method of remotely accessing your Pi desktop from anywhere on the planet.

And that’s pretty cool!

Conclusion

Remote access to your Raspberry Pi can be useful, especially if you maintain a “fleet” of remote microcomputers. Eliminating the keyboard, mouse, and monitor can save you money and space. 

From the SSH method of remote terminal access to Raspberry Pi Connect, there is a remote access method that will work well for your project.

Now, isn’t that more than remotely fascinating?

Resources

PDF Version – A PDF version of this article, in a ZIP file.

Raspberry Pi Connect Documentation – The latest documentation on Raspberry Pi Connect.

 

Raspberry Pi Remote Access – 3 Methods
Summary
Raspberry Pi Remote Access - 3 Methods
Article Name
Raspberry Pi Remote Access - 3 Methods
Description
Learn three methods of remotely accessing your Raspberry Pi - SSH, VNC and Raspberry Pi Connect.
Author
Publisher Name
DroneBot Workshop
Publisher Logo
Subscribe
Notify of

1 Comment
Oldest
Newest
Inline Feedbacks
View all comments
harold finz
4 months ago

Re the SSH approach: Here was my predicament when connecting via ssh: I’m running a “sensor-based” camera reporter on a headless pi zeroWH, which I start with a python script from a Mac using ssh. When the mac goes to sleep, it times-out the ssh session, which in turn kills the scripts on the pizeroWH. My “workaround” was to start from a Pi3 that doesn’t sleep. It worked but it felt very unsatisfying. I’m sure I’m missing something. Any help? BTW, this connect article came at exactly the right moment. Because, there are always parameters that need to be tweaked.… Read more »