Remotely Control Your Raspberry Pi via SSH: A Complete Guide
SSH is the best method to access the command line of your Raspberry Pi from another computer on the same network, allowing you to manage the device without a monitor or keyboard.
Securely connect to your Pi from any computer.
Secure Shell (SSH) is a network protocol that allows you to securely control a remote device through a command-line interface. This is a basic and essential skill for anyone using a Raspberry Pi.
Step 1: Enable SSH on the Raspberry Pi
For security reasons, SSH is disabled by default on Raspberry Pi OS. There are two ways to enable it:
- Method 1 (With a monitor): Open the Terminal on the Pi and type
sudo raspi-config. Navigate to `Interfacing Options` > `SSH` > `Yes` to enable it. - Method 2 (Headless): After flashing the OS to the SD card, insert the card into your computer. In the `boot` partition, create an empty, extensionless file named
ssh. When the Pi boots, it will see this file and automatically enable SSH.
Step 2: Find Your Raspberry Pi's IP Address
You need the Pi's IP address to connect. You can find it by logging into your Wi-Fi router's admin page or by using the command hostname -I in the Pi's terminal.
Step 3: Connect From Your Computer
Open Terminal (on macOS/Linux) or PowerShell/Command Prompt (on Windows) and type the following command, replacing `pi` with your username and `your_pi_ip_address` with the IP address you found:
The first time you connect, you will receive a warning about the 'authenticity of host'. Type `yes` to continue. Then, enter the default password, which is `raspberry`. Be sure to change this password immediately after logging in successfully using the `passwd` command.
Also available in Vietnamese
Read Vietnamese version →