Transfer Files to and from a Raspberry Pi with SFTP
Learn how to securely connect FileZilla to a Raspberry Pi with SFTP, then upload, download, browse, edit, rename, move, and delete files.
SFTP lets you manage files on a Raspberry Pi from a Windows, macOS, or Linux computer. With FileZilla Client, you can browse the Pi's folders and securely upload, download, rename, move, delete, and sometimes edit files without using a monitor and keyboard connected to the Pi.
This guide assumes that you know the Raspberry Pi username and password, can connect the Pi to a network, and understand basic files, folders, and paths. For broader setup guidance, see the Raspberry Pi online course.
What SFTP is
SFTP means Secure File Transfer Protocol. It is a protocol for securely transferring and managing files on another computer. In addition to copying files, SFTP supports directory browsing, folder creation, renaming, moving, deleting, and optional remote editing.
SFTP runs through SSH, or Secure Shell. SSH encrypts the login credentials and the data transferred between your computer and the Raspberry Pi. This is different from traditional FTP, which normally sends information without the same built-in encryption.
How the client-server model works
A client-server model divides the connection into two roles:
- The Raspberry Pi is the SFTP server when its SSH service is enabled and running. The server accepts authenticated connections and provides access to files allowed by the account.
- Your desktop or laptop runs an SFTP client. The client application connects to the Pi and displays local and remote files.
This lesson uses FileZilla Client. FileZilla Server is not needed on your computer, and other SFTP clients can also work.
Prerequisites before connecting
- Power on the Raspberry Pi and connect it to the network.
- For a simple home-network connection, connect the Pi and the client computer to the same local network. Access from another network requires additional, carefully configured remote access.
- Enable SSH on the Raspberry Pi.
- Find the Pi's current IP address or hostname.
- Have an existing Raspberry Pi account name and its password available.
Before enabling network access, change any default or weak credentials and use a unique, strong password. Do not assume that a commonly documented default account exists on your installation.
You can review the SSH setup process in Enable SSH in Raspberry Pi OS. The name and menu layout of configuration options can vary between Raspberry Pi OS versions.
Enable and verify SSH
Enable SSH with the configuration utility
Open a terminal on the Raspberry Pi and start the configuration utility:
sudo raspi-config
Open the interface or service settings, choose SSH, and enable it. Select the finish option when prompted. The exact menu wording can vary by Raspberry Pi OS release.
You can also read about the configuration utility in Raspi-config.
Check the SSH service
Check whether the SSH service is active:
sudo systemctl status ssh
Look for an active or running state. Press q to leave the status view. If SSH should be available after every reboot, start it now and enable it at boot:
sudo systemctl enable --now ssh
SFTP normally uses SSH's standard port 22. A port is a numbered endpoint used by network services. Use another port only if you have deliberately changed the SSH configuration.
Find the Pi's IP address
Run this command on the Raspberry Pi:
hostname -I
The command may display more than one address. Choose the address belonging to the active network connection. You can also check the router's connected-device list. An IP address locates the Pi on a network; a hostname is a human-readable network name that may identify it instead.
Install and open FileZilla Client
Obtain FileZilla from its official source and install the client application for your operating system. Choose FileZilla Client, not FileZilla Server. Then open FileZilla on the Windows, macOS, or Linux computer that will connect to the Pi.
Configure an SFTP connection in FileZilla
You can use Site Manager for a saved connection or Quickconnect for a temporary connection. Site Manager is useful when you connect regularly because it stores the host and connection settings.
Site Manager settings
Open Site Manager, create a new site, and enter these values:
| Setting | Typical value | Purpose |
|---|---|---|
| Protocol / connection type | SFTP - SSH File Transfer Protocol | Selects encrypted file transfer through SSH |
| Host | Raspberry Pi IP address or hostname, such as 192.168.1.50 | Identifies the Pi |
| Port | 22 | Uses the usual SSH/SFTP port |
| User | Your Raspberry Pi account name | Identifies the account to authenticate |
| Password | The password for that account | Authenticates the account |
Use a normal password logon if password authentication is enabled. For recurring access, key-based authentication is usually preferable: the client uses a private key instead of sending a password. Protect the private key with a passphrase and do not share it.
Quickconnect
In the Quickconnect fields, enter the Pi's address as the host, your username, password, and port 22. Make sure the connection is SFTP rather than FTP. If the Quickconnect interface does not provide a separate protocol selector, use the SFTP connection format supported by your FileZilla version, or configure the connection in Site Manager.
Verify the host key
On the first connection, FileZilla may show the server's SSH host key. A host key is a server identity key that helps an SSH client detect whether it is connecting to the expected device.
Verify that the address belongs to your Raspberry Pi before accepting and saving the key. Do not blindly accept an unexpected warning. If the Pi was reinstalled, its SSH keys may have changed; however, an address that now points to a different device or an unexplained key change requires investigation first.
Understand the FileZilla interface
After a successful connection, FileZilla commonly shows local files on the left and remote files on the right.
| Area | Represents | Typical use |
|---|---|---|
| Local site | Files and folders on your computer | Choose files to upload or a destination for downloads |
| Remote site | Files and folders on the Raspberry Pi | Browse, create, and manage Pi files |
| Transfer queue | Pending, successful, or failed transfers | Monitor progress and retry failed items |
| Connection/status log | Connection messages and server responses | Diagnose authentication, network, and permission problems |
The initial remote location is typically the connected user's home directory, the personal directory assigned to that account. Work under this directory unless you understand Linux ownership and permissions.
Upload a file to the Raspberry Pi
- In the local pane, browse to a file such as a Python script.
- In the remote pane, open a suitable destination folder under the connected user's home directory. Create a project folder if necessary.
- Drag the local file into the remote pane.
- Watch the transfer queue and status messages until the transfer is reported as successful.
An upload copies the local file to the Pi. It does not automatically run a script or change the original local copy.
Download a file from the Raspberry Pi
- Browse the remote pane to the folder containing the file, such as a log or program output.
- Use the local pane to select a destination folder on your computer.
- Drag the remote file into the local pane.
- Wait for the queue to report completion, then open the downloaded copy locally if needed.
Manage remote files
Within the permissions of the connected account, right-click items in the remote pane to perform tasks such as:
- Create a new directory for a project.
- Rename an uploaded file.
- Move a file into another folder.
- Delete an unwanted test file after confirming that it is safe to remove.
FileZilla may support remote editing through its file association settings. When you edit a remote file, the client commonly downloads a temporary local copy, opens it in an editor, and uploads the changed copy when you save. Changes can overwrite the remote file, so keep backups of important data and confirm that the account has permission to write to the file.
For command-line file operations and paths, see File management and Directory management.
Common connection problems
| Symptom | Likely cause | Resolution |
|---|---|---|
| Connection refused | SSH is disabled, the service is not running, or the port is incorrect | Enable SSH, check sudo systemctl status ssh, and use port 22 unless SSH uses another configured port |
| Connection timed out | The address is wrong, the Pi is offline, the networks are not reachable, or a firewall or router blocks access | Confirm the address with hostname -I or the router, check power and network connectivity, and use the same local network for a basic test |
| Authentication failed | Wrong username or password, a disabled account, or required key authentication | Confirm the exact account details, use the account created during setup, or configure the required private key |
| Host key warning | The Pi was reinstalled, keys were regenerated, the address belongs to another device, or interception is possible | Verify the Pi through a trusted local method, then remove or update the old saved key only after verification |
| Permission denied during transfer | The account does not own the destination or the file has restrictive permissions | Use a directory owned by the account; adjust ownership or permissions carefully from a terminal when appropriate |
Connection refused
Check SSH before changing FileZilla settings. Enable it through the Raspberry Pi configuration utility, confirm that the service is running, and use port 22 unless you intentionally configured another SSH port.
Timeout or unreachable host
The Pi's address can change after a network reconnect. Confirm it again with hostname -I, make sure the Pi is powered on, and check that both devices are on reachable networks. A firewall or router may block access. Do not solve a local connection problem by exposing SSH to the public internet.
Authentication failure
Check spelling and capitalization in the username, then enter the password for that Raspberry Pi account. Do not assume that an old default username exists. If password login is disabled, configure FileZilla with the correct SSH private key.
Permission errors
Successful login does not grant access to every file. Linux file permissions determine who can view, modify, or delete each file and directory. Transfer to a folder owned by the connected user, or carefully investigate ownership and permissions before changing them.
Security practices
- Use SFTP instead of unencrypted FTP.
- Use a strong, unique password or SSH key authentication for regular access.
- Verify unexpected host-key warnings before accepting them.
- Do not expose SSH or SFTP directly to the public internet without appropriate hardening, firewall rules, updates, and an access plan.
- Keep private files on the Raspberry Pi protected and avoid transferring sensitive data to shared computers.
- Close the FileZilla session when finished.
For a related remote-access overview, see Access Raspberry Pi OS remotely. You can also review how to change the Raspberry Pi password.
Quick checklist
- The Pi is powered on and reachable on the network.
- SSH is enabled and its service is running.
- You know the current IP address or hostname.
- FileZilla Client is installed on the computer.
- The protocol is SFTP, the host is correct, and the port is normally
22. - The username and password or private key belong to a valid Raspberry Pi account.
- The first-connection host key has been verified.
- The transfer queue confirms that uploads or downloads completed.