Video Tutorial (Optional)
Watch first if you want to follow the setup in real time.
Project Overview
Raspberry Pi SSH remote access: In this guide, you will SSH (Secure Shell) from a local computer (Mac shown) into a Raspberry Pi to get remote command line control without connecting a monitor or keyboard.
SSH is a secure network protocol that lets you remotely access a command line interface on another computer over your network. This is especially useful for Raspberry Pi projects when you do not want to use peripherals.
Subscribe: Youtube
Support: https://www.buymeacoffee.com/mmshilleh
- Time: 10 to 20 minutes
- Skill level: Beginner
- What you will build: An SSH connection from your local computer to your Raspberry Pi for remote terminal access
Parts List
From ShillehTek
- Raspberry Pi accessories - optional peripherals, cables, and add-ons for your Pi setup
External
- Raspberry Pi with Raspberry Pi OS installed - the computer you will connect to
- Local computer with a terminal (Mac shown, similar steps on Linux) - used to initiate the SSH session
- Local network connection (Wi-Fi or Ethernet) - both devices must be on the same network for this guide
Note: This tutorial assumes your Raspberry Pi and your local computer are on the same local network (Wi-Fi or Ethernet).
Step-by-Step Guide
Step 1 - Confirm your Pi and computer are connected
Goal: Ensure both devices can communicate over the network.
What to do: Connect your Raspberry Pi and your computer to the same local network, either over Wi-Fi or Ethernet. (Wi-Fi is used in this example.)
Expected result: Your Raspberry Pi and your computer are on the same network and ready for SSH setup.
Step 2 - Enable SSH on the Raspberry Pi
Goal: Turn on the SSH service so the Pi can accept remote SSH connections.
What to do: On the Raspberry Pi desktop, open Raspberry Pi Configuration and enable SSH.
Enable SSH by selecting the SSH toggle and clicking OK. You do not need to enable I2C for this tutorial.
Restart your Raspberry Pi. You can do this from the command line with:
Code:
sudo reboot
Expected result: The Raspberry Pi reboots with SSH enabled.
Step 3 - Get the SSH info (IP address, username, password)
Goal: Collect the details needed to connect from your local computer.
What to do: On the Raspberry Pi, open a terminal and find your IP address using:
Code:
ifconfig
Copy the IP address next to the inet value in the wlan0 section (it may differ depending on your connection).
Next, find your username with:
Code:
whoami
You will also need the password you use to log in to the Raspberry Pi.
Expected result: You have the Raspberry Pi IP address, username, and password ready to use on your local computer.
Step 4 - Connect from your local computer using SSH
Goal: Start a remote SSH session from your computer into the Raspberry Pi.
What to do: On your Mac, open a Terminal window and run an SSH command in this format:
Code:
ssh username@ip-address
Press Enter. You will be prompted for your password. You may also be asked to accept the RSA fingerprint; type yes to continue.
Expected result: You gain remote command line access to your Raspberry Pi over SSH.
Conclusion
You set up SSH remote access to a Raspberry Pi from your local computer, making it easy to control the Pi from a terminal without a monitor or keyboard. With the IP address, username, and password, you can connect quickly whenever both devices are on the same network.
Want Raspberry Pi accessories for your setup? Shop parts at ShillehTek.com. If you want help customizing a Raspberry Pi or IoT build for your project, check out our IoT consulting services.