Install and Configure FTP Server on Debian Linux – Raspberry Pi

raspberry-pi-logo-ftpFTP is a simple way to transfer files from your Raspberry Pi to other devices. It is also the fastest method for transferring data between devices – at least faster than SAMBA (see Raspberry vs Banana Pi Benchmarks: Do SATA and Gigabit Matter?). If you are using your Raspberry Pi to stream media to other devices, FTP is definitely the way to go even though SAMBA may be more convenient for Windows users, you can always use SAMBA to manage the files if necessary.

Pi Unit
Processor
RAM
RAM Bus
Network
WiFi
USB
SATA
Cost
Raspberry Pi 3
1.2 GHz ARMv8
Quad Core
1 GB DDR2
450 MHz
100 Mbit
Yes
4
No
$35
Raspberry Pi 2
900 MHz ARMv7
Quad Core
1 GB DDR2
450 MHz
100 Mbit
No
4
No
$35.00
Raspberry Pi
700 MHz ARMv6
Single Core
512 MB SDRAM
400 MHz
100 Mbit
No
4
No
$25
Banana Pi
1 GHz ARMv7
Dual Core
1 GB DDR3
432 MHz
Gigabit
No
2
Yes
$36.99
Banana Pi Pro
1 GHz ARMv7
Dual Core
1 GB DDR3
432 MHz
Gigabit
Yes
2
Yes
$45.00

Install and Configure FTP Server on Linux

FTP is awesome, you can even access it outside your home network if you configure free dynamic DNS and set up port forwarding on your router to the Linux device. Some of you may be thinking why not just use built-in SFTP which is enabled by default with the Linux SSH server. The reason is that low powered devices have to deal with the encryption which is heavy on the weak CPU of the Raspberry Pi which limits your data transfer rate to about 5.5 MB/s. If you set secure passwords you will still be safe, furthermore if you are only using it locally then the security risk is minimal.

Install FTP Server

Update and upgrade your packages

sudo apt-get update && sudo apt-get upgrade -y

Install vsftpd – the very secure FTP daemon

sudo apt-get install vsftpd -y

Configure FTP Server on Linux

Edit vsftpd configuration file

sudo nano /etc/vsftpd.conf

Edit these lines, first disable anonymous FTP access for security purposes

anonymous_enable=YES

change to

anonymous_enable=NO

Enable local users, anybody with a local user account can access any directory that they own, uncomment by removing the ‘#' character. This means you r pi user will be able to access its /home/users/pi directory or any other directories for which it has ownership like mounted USB drives. Change this line

#local_enable=YES

to

local_enable=YES

If you want to enable FTP uploading for the user in their home directory, uncomment the write_enable line by changing

#write_enable=YES

to

write_enable=YES

On Linux hidden files are preceded with a ‘.' if you want to be able to see hidden folders, add this line at the bottom

force_dot_files=YES

Ctrl+X, Y and Enter to save the vsftp configuration

Enable FTP Root User

Enable the root user for ftp access, this is not recommended but I needed it for some local data transfer tests on my home network for benchmarking. I also use it to execute scripts via FTP which require root access. If you do use root access on FTP then make sure your password is secure, make it long and combine Upper case, lower case, numbers and special characters.

sudo nano /etc/ftpusers

comment out the root user by adding a # prefix so the root line looks like this

#root

Ctrl+X, Y and Enter to save the ftp users modification

Restart the FTP server

sudo service vsftpd restart

You can access the FTP server on port 21 using programs like FileZilla or WinSCP. If you want to use an internet browser the format is ftp://user:password@ip.address:21 you can also use your dynamic IP address ftp://user.password@dynamicdns:21. Don't forget to set up port forwarding if you want to access your FTP server outside your local network.