Remote Access to Raspberry Pi via SSH
Accessing a Raspberry Pi remotely without a dedicated monitor, keyboard, or mouse—a setup known as “headless mode”—is an efficient way to manage your device. By enabling Secure Shell (SSH), you can establish a secure command-line connection to your Pi from any computer on your local network. This guide covers the essential steps to prepare your microSD card, enable SSH, find your Pi’s network IP address, and successfully establish a remote connection.
Preparing the MicroSD Card and Enabling SSH
To configure your Raspberry Pi for remote access from its very first boot, you need to enable SSH during the operating system flashing process.
- Use Raspberry Pi Imager: Download and open the official Raspberry Pi Imager tool on your main computer.
- Select OS and Storage: Choose your preferred operating system (such as Raspberry Pi OS Lite) and select your microSD card.
- Open Advanced Settings: Click the gear icon (OS Customization) before writing the image.
- Enable SSH: Check the box to enable SSH. Choose the option to use password authentication.
- Set Username and Password: Define a unique username and a strong password. The traditional default credentials are often disabled by default for security.
- Configure Wi-Fi (Optional): If you are not using a wired Ethernet cable, enter your local Wi-Fi SSID and password in this menu so the Pi can connect to your network automatically.
- Write the OS: Save the settings and click “Write” to flash the microSD card.
Finding the Raspberry Pi IP Address
Once the microSD card is ready, insert it into the Raspberry Pi, connect the device to your router via Ethernet or power it on to let it connect to the Wi-Fi, and wait a couple of minutes for it to boot. To connect via SSH, you need to know the device’s IP address on your local network.
Method 1: Router Admin Page
Log into your home router’s web interface via a browser. Navigate to the “Connected Devices” or “DHCP Client List” section to find the entry for your Raspberry Pi and note its IP address.
Method 2: Network Scanning Tools
Download a network scanning tool like Fing (for mobile devices) or Advanced IP Scanner (for Windows/Mac). Run a scan of your local network to locate the IP address assigned to the Raspberry Pi.
Method 3: Hostname Routing
In many modern network setups, you can bypass finding the exact IP
address by using the local mDNS hostname. By default, you can often
attempt to connect using raspberrypi.local instead of a
numerical IP.
Connecting to the Pi via SSH
With the IP address secured, you can now open a terminal from your main computer to log into the Raspberry Pi.
On Windows, Mac, or Linux Terminal
Open your system’s built-in Terminal (or PowerShell/Command Prompt on
Windows) and type the following command, replacing username
with the name you created and IP_ADDRESS with your Pi’s
actual IP:
ssh username@IP_ADDRESSIf you are using the default hostname, the command will look like this:
ssh username@raspberrypi.localAccepting the Security Key and Logging In
The first time you connect, your computer will display a warning
stating that the authenticity of the host cannot be established. Type
yes and press Enter to continue. You will then be prompted
to type the password you created during the imaging process. Note that
characters will not appear on the screen while typing your password.
Press Enter, and you will be greeted by the Raspberry Pi command prompt,
giving you full remote control over the system.