A Beginner’s Guide to SSH on a Raspberry Pi
A Beginner’s Guide to SSH on a Raspberry Pi
SSH (Secure Shell) allows you to access and control your Raspberry Pi remotely from another device, like a laptop or desktop. Instead of plugging in a monitor and keyboard, you can log in through the command line and work on your Pi as if you were right in front of it.
Step 1: Enable SSH on Your Raspberry Pi
By default, SSH might be disabled on your Raspberry Pi. To enable it:
- Boot up your Raspberry Pi and open the terminal.
- Type "sudo raspi-config"
- Navigate to Interfacing Options → SSH → Enable
- Exit and reboot your Pi if needed.
Alternatively, if you're setting up your Pi headless (without a monitor), you can enable SSH by adding an empty file named ssh (no extension) to the boot partition of the SD card.
Step 2: Find Your Raspberry Pi’s IP Address
To connect, you'll need your Raspberry Pi’s IP address. Find it by running:
hostname -I
Or check your router’s connected devices list. The IP will look something like 192.168.1.100.
Step 3: Connect to Your Raspberry Pi from Another Device
From a Windows, Mac, or Linux terminal, type:
ssh pi@192.168.1.100
Replace 192.168.1.100 with your actual Raspberry Pi IP address. The default username is pi, and the default password is raspberry (change this ASAP for security).
If you're on Windows and don't have SSH built-in, use PuTTY (a free SSH client).
Step 4: Basic Linux Commands
Once connected via SSH, you can control your Pi as if you're using its terminal directly.
Command | Description |
ls | List files in the current directory |
cd foldername | Navigate to a folder |
nano filename | Edit a text file |
sudo reboot | Restart the Pi |
exit | Close the SSH session |
Step 5: Secure Your SSH Connection (Optional but Recommended)
To prevent unauthorized access:
- Change the default password: Run
passwd
after logging in. - Use SSH keys instead of passwords: Set up an SSH key for easier, more secure logins.
- Disable SSH root login: Edit
/etc/ssh/sshd_config
and setPermitRootLogin no
.
Final Thoughts
SSH makes it easy to manage your Raspberry Pi remotely without needing a monitor or keyboard. Once you're comfortable, you can explore using SSH for file transfers, automation, and even remote scripting.
Need Raspberry Pi Expertise?
If you need help with your Raspberry Pi projects or have any questions, feel free to reach out to us!
Email us at: info@pacificw.com
Image: Gemini
Comments
Post a Comment