Intro

Sometimes you need to access a Raspberry Pi without connecting it to a monitor, keyboard, and mouse. Perhaps the Raspberry Pi is embedded in a robot or mounted in an inconvenient location. Or maybe you don’t have a spare monitor. To remotely control your Raspberry Pi from another device on your local network, use one of the following services:

  • SSH (Secure SHell)- provides secure access to a terminal session on your Raspberry Pi.
  • VNC (Virtual Network Computing)- provides secure access to a desktop screen share on your Raspberry Pi.
    • All you need is another computer, a local network, and the local IP address of your Raspberry Pi.
  • Raspberry Pi Connect- shares your Raspberry Pi’s screen securely with no need to determine your local IP address.

Get Raspberry Pi’s IP address

  • Show the Raspberry Pi’s IP:
    hostname -I

SSH into Raspberry Pi

Enable SSH Server

Raspbian OS

https://www.raspberrypi.com/documentation/computers/remote-access.html#ssh

  • Enable SSH Server on the Raspberry Pi:
    • Enable SSH via raspi-config
    • Alternatively, create an empty file named ssh (no extension) in the /boot directory of your Pi’s SD card
    sudo raspi-config
    Then, navigate to Interfacing Options > SSH > Enable

Hint

If you have an OS other than Raspbian (e.g. Ubuntu), you may need to first install the utility by running sudo apt install raspi-config

Connect to an SSH Server

Hint

Ubuntu does not have SSH server enabled out of the box, but can be installed by running sudo apt install openssh-server

  • Open a terminal on your host machine (Linux/macOS) or use an SSH client (e.g., PuTTY for Windows)

    • Use the SSH command to connect to your Raspberry Pi. Replace <user> with your username (default is pi), and <ip-address> with the Raspberry Pi’s IP address:
    ssh <user>@<ip-address>

    Example:

    ssh pi@192.168.68.121
  • Enter the password for the Raspberry Pi when prompted

  • Once authenticated, you will be logged into the Raspberry Pi’s terminal remotely

<username>@<hostname> ~ $

Set up static IP

Optional: Setting Up Passwordless SSH (via SSH keys)

  • Generate SSH keys on your local machine (e.g. laptop)
    • Skip this step if you already have it:
    ssh-keygen
  1. Copy the public key to the Raspberry Pi:

    ssh-copy-id <user>@<ip-address>
  2. You can now SSH into your Raspberry Pi without a password:

    ssh <user>@<ip-address>

Transferring Files to/from Your Pi

Use scp to securely copy files between your local machine and the Pi:

  • Copy a file to the Pi:
    scp file.txt pi@<RPI_IP_ADDRESS>:/home/pi/
  • Copy a file from the Pi:
    scp pi@

Screen share with VNC

https://www.raspberrypi.com/documentation/computers/remote-access.html#vnc