Home » Using FTP and SFTP on Raspberry Pi: Complete Guide

Using FTP and SFTP on Raspberry Pi: Complete Guide

SBC Tutorials

Using FTP/SFTP on Raspberry Pi

File transfers between the Pi and another device are one of the more common tasks when working with a Raspberry Pi. Whether you’re uploading Python scripts, downloading log files, backing up projects, transferring media or managing web server content, you need a reliable file transfer solution.

FTP (File Transfer Protocol) and SFTP (SSH File Transfer Protocol) are two of the most common ways to transfer files. Both allow files to be moved over a network, but are very different in security, performance and configuration.

Knowing how FTP and SFTP work on Raspberry Pi can simplify system administration enormously and save you from having to keep swapping out SD cards or plugging in monitors and keyboards.

This guide will cover the differences between FTP and SFTP, how to install them, security considerations, troubleshooting techniques, and best practices for real-world Raspberry Pi deployments.

Understanding File Transfer Protocols

File transfer protocols provide a standardized way for computers to exchange files across a network.

Instead of physically connecting storage devices, files can be uploaded, downloaded, renamed, deleted, and managed remotely.

Typical tasks include:

  • Uploading website files
  • Editing scripts remotely
  • Downloading logs
  • Managing backups
  • Transferring media files
  • Updating applications
  • Sharing files across devices

What Is FTP?

FTP stands for File Transfer Protocol.

It was originally developed in the early days of computer networking and remains widely supported today.

FTP allows users to:

  • Browse directories
  • Upload files
  • Download files
  • Rename files
  • Delete files
  • Create folders

A typical FTP connection looks like:

Computer
   ↓
FTP Server
   ↓
File Storage

While FTP remains simple and efficient, it has a major drawback.

Why FTP Is Considered Insecure

Traditional FTP sends information in plain text.

This includes:

  • Usernames
  • Passwords
  • Commands
  • File transfer details

Anyone monitoring network traffic could potentially view this information.

For this reason, FTP should generally be limited to:

  • Local networks
  • Test environments
  • Isolated systems

It should rarely be exposed directly to the internet.

What Is SFTP?

SFTP stands for SSH File Transfer Protocol.

Despite the similar name, SFTP is completely different from FTP.

SFTP operates through the Secure Shell (SSH) protocol.

Advantages include:

  • Encrypted file transfers
  • Secure authentication
  • Protection against eavesdropping
  • Single-port operation
  • Easier firewall configuration

Most Raspberry Pi users choose SFTP because it is already available whenever SSH is enabled.

FTP vs SFTP

| Feature | FTP | SFTP | | – | — | | | Encryption | No | Yes | | Password Protection | Weak | Strong | | Internet Safe | No | Yes | | Uses SSH | No | Yes | | Setup Complexity | Moderate | Very Easy | | Recommended Today | Rarely | Yes |

For almost all modern Raspberry Pi projects, SFTP is the preferred choice.

Common Use Cases

FTP and SFTP are useful for:

Raspberry Pi Web Servers

Upload website content quickly.

Python Development

Transfer scripts between development machines and the Pi.

Media Servers

Upload music, videos, and images.

Backup Systems

Copy important files automatically.

Home Automation

Transfer configuration files and logs.

Remote Administration

Manage files without using command-line tools.

Checking SSH Status

Since SFTP depends on SSH, verify SSH is running.

Check service status:

sudo systemctl status ssh

Expected output:

active (running)

If SSH is not enabled:

sudo systemctl enable ssh
sudo systemctl start ssh

Finding Your Raspberry Pi IP Address

Determine the Pi’s network address:

hostname -I

Example:

192.168.1.100

This address is required when connecting remotely.

Using SFTP Without Installing Anything

One of the best features of Raspberry Pi OS is that SFTP works automatically when SSH is enabled.

No additional software is required on the Pi.

Connection example:

sftp pi@192.168.1.100

After entering the password, a secure file transfer session begins.

Basic SFTP Commands

Once connected:

List files:

ls

Change directory:

cd projects

Download a file:

get script.py

Upload a file:

put program.py

Create directory:

mkdir backups

Delete file:

rm oldfile.txt

Exit:

bye

These commands provide basic file management capabilities.

Using Graphical SFTP Clients

Many users prefer graphical tools.

Popular clients include:

| Client | Operating System | | | – | | FileZilla | Windows/Linux/macOS | | WinSCP | Windows | | Cyberduck | macOS/Windows | | Nautilus | Linux | | Dolphin | Linux |

Graphical clients simplify drag-and-drop transfers.

Connecting with FileZilla

Typical settings:

Setting Example
Host 192.168.1.100
Protocol SFTP
Username pi
Password Your Password
Port 22

Click Connect.

The Raspberry Pi file system appears in a split-pane interface.

Files can now be transferred by dragging and dropping.

Using SSH Keys with SFTP

Passwords work, but SSH keys provide stronger security.

Generate a key pair:

ssh-keygen

Copy the key:

ssh-copy-id pi@192.168.1.100

Afterward:

sftp pi@192.168.1.100

can authenticate without passwords.

Benefits include:

  • Improved security
  • Faster login
  • Protection against password attacks

Installing an FTP Server

Although SFTP is preferred, some legacy applications still require FTP.

A common FTP server for Raspberry Pi is VSFTPD.

Install:

sudo apt update
sudo apt install vsftpd -y

Verify:

sudo systemctl status vsftpd

Configuring VSFTPD

Edit configuration:

sudo nano /etc/vsftpd.conf

Common settings:

anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022

These settings:

  • Disable anonymous access
  • Allow local users
  • Permit uploads
  • Set file permissions

Restarting FTP Service

Apply changes:

sudo systemctl restart vsftpd

Enable startup:

sudo systemctl enable vsftpd

Testing FTP Connections

Using a client:

Host: 192.168.1.100
Port: 21
Username: pi
Password: yourpassword

Successful connection displays accessible directories.

Understanding Active and Passive FTP

FTP can operate in two modes.

Active Mode

The server initiates part of the connection.

This often causes firewall problems.

Passive Mode

The client initiates all connections.

This is generally preferred.

Example configuration:

pasv_enable=YES

Most modern FTP clients use passive mode automatically.

File Permissions and Ownership

Many file transfer issues involve permissions.

View ownership:

ls -l

Example:

-rw-r--r-- 1 pi pi file.txt

The first “pi” indicates ownership.

The second “pi” indicates the group.

Changing File Ownership

Assign ownership:

sudo chown pi:pi filename

For entire directories:

sudo chown -R pi:pi directory

This often resolves upload issues.

Understanding Linux Permissions

Permission notation:

rwxr-xr-x

Meaning:

| Symbol | Meaning | | | – | | r | Read | | w | Write | | x | Execute |

Modify permissions:

chmod 755 script.sh

Transferring Large Files

Raspberry Pi systems often store:

  • Video archives
  • Disk images
  • Backups
  • Media libraries

For large transfers:

Use Ethernet

Wired connections provide:

  • Higher speed
  • Greater reliability
  • Lower latency

Use SFTP

Encryption overhead is usually negligible on modern Pi models.

Avoid Wi-Fi Congestion

Large file transfers may suffer on busy wireless networks.

Automating File Transfers

SFTP can be automated.

Example:

sftp user@server <<EOF
put backup.zip
bye
EOF

This enables scheduled transfers using cron jobs.

Creating Backup Scripts

Example:

tar -czf backup.tar.gz /home/pi/projects

Transfer:

scp backup.tar.gz user@server:/backups

Many administrators combine backup creation and SFTP transfers into automated workflows.

Using SCP Instead of SFTP

SCP (Secure Copy) is another SSH-based tool.

Upload:

scp file.txt pi@192.168.1.100:/home/pi

Download:

scp pi@192.168.1.100:/home/pi/file.txt .

SCP is ideal for quick transfers.

Securing FTP and SFTP Services

Security should always be a priority.

Use Strong Passwords

Avoid:

password
123456
raspberry

Use long, unique passwords.

Prefer SFTP

Whenever possible:

Use SFTP
Avoid FTP

Encryption protects credentials and data.

Disable Unused Services

If FTP is not required:

sudo systemctl disable vsftpd

Use a Firewall

Install UFW:

sudo apt install ufw

Allow SSH:

sudo ufw allow 22

Enable:

sudo ufw enable

Keep Software Updated

Regular updates improve security:

sudo apt update
sudo apt full-upgrade

Troubleshooting Common Problems

Connection Refused

Check service status:

sudo systemctl status ssh

or:

sudo systemctl status vsftpd

Authentication Failure

Verify:

  • Username
  • Password
  • SSH keys
  • Permissions

Cannot Upload Files

Check ownership:

ls -l

Review permissions.

Firewall Blocking Access

Verify firewall rules:

sudo ufw status

Slow Transfers

Possible causes:

  • Weak Wi-Fi signal
  • SD card limitations
  • Network congestion
  • Large encryption workloads on older hardware

SFTP for Internet Access

Many users access Raspberry Pi systems remotely.

When using the internet:

Use SSH Keys

More secure than passwords.

Change Default User

Avoid leaving the default “pi” account active.

Use Fail2Ban

Protect against brute-force attacks.

Keep Port 22 Protected

Consider VPN access rather than exposing services directly.

These measures significantly improve security.

Final Thoughts

Learning how to use FTP and SFTP on Raspberry Pi is one of the most valuable skills for managing files remotely. Whether you are administering servers, uploading website content, backing up projects, transferring media, or automating maintenance tasks, file transfer protocols provide a convenient and efficient workflow.

While traditional FTP remains available for compatibility purposes, SFTP is the modern standard and should be the preferred solution in nearly all situations. Because SFTP is built directly into the SSH service already included with Raspberry Pi OS, it offers excellent security, simple setup, and reliable performance with minimal configuration.

For most Raspberry Pi users, enabling SSH and using an SFTP client such as FileZilla or WinSCP provides everything needed for secure and efficient remote file management.

You may also like