How to send files to Raspberry Pi using SSH
What is SSH?
SSH stands for Secure Shell — it’s a network protocol that lets you securely log in to and control another computer remotely, usually over the internet or your local network.
Think of it as opening a remote terminal window on your Raspberry Pi from your laptop or another device.
What You Can Do with SSH:
- Run terminal commands on your Pi from another machine
- Transfer files (using scp, rsync, or SFTP)
- Install software, run Python scripts, update your system
- Control a headless Raspberry Pi (one without monitor/keyboard)
Enable SSH on Raspberry Pi
Option 1: Using Raspberry Pi OS with Desktop
- Go to Preferences → Raspberry Pi Configuration
- Under the Interfaces tab, enable SSH
- Reboot afterwards,
sudo reboot
Option 2: If You’re Using Pi Headless
- Put a file named ssh (with no extension) into the boot partition of the SD card
- When the Pi boots, SSH will be enabled
Find Pi's IP address
- In Terminal,
hostname -I
- You will see something that looks like this:
192.168.1.42
, this is your pi's IP address
File Transfer
Make sure your computer is on the same network as the Pi.
1. From Your Computer → Raspberry Pi
scp /path/to/local/file pi@<raspberry_pi_ip>:/home/pi/
2. To Send a Whole Folder
scp -r /path/to/local/folder pi@<raspberry_pi_ip>:/home/pi/
3. From Raspberry Pi → Your Computer
scp pi@<raspberry_pi_ip>:/home/pi/somefile.txt /local/path/
Tips
- The default username is usually
pi
- If SSH asks you to confirm the connection the first time, type
yes
- If your Pi is using a custom SSH port (e.g. 2222), add
-P 2222