FTP 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.
|Raspberry Pi 3|
|Raspberry Pi 2|
|Banana Pi Pro|
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
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
If you want to enable FTP uploading for the user in their home directory, uncomment the write_enable line by changing
On Linux hidden files are preceded with a ‘.’ if you want to be able to see hidden folders, add this line at the bottom
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
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:email@example.com: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.