Hi, today you will learn how to set up an FTP server on any Raspberry Pi and use it with HomeStash to sync pictures and videos from your phone. Let’s get to work!
Vsftpd setup on the Raspberry Pi
Firstly, we’ll have to install
vsftpd. Vsftpd is an Open Source FTP server that our RPi will host.
Open a terminal, connect to your Raspberry Pi using SSH and enter the following command:
sudo apt install vsftpd
Now, we’ll have to tweak the configuration file for security reasons using
nano or any text editor.
sudo nano /etc/vsftpd.conf
Find and update the following flags:
write_enable=YES local_umask=022 chroot_local_user=YES anonymous_enable=NO
Some of them are commented. Just uncomment.
Add the following lines at the end of the file:
Press CTRL + X to save the file and confirm with Y to exit.
Create FTP directory
Create an FTP directory if needed or use an existing one.
If you already use external storage or want other path, just change the
local_root variable in the previous configuration file and skip the data-dir creation step.
mkdir -p /home/$USER/FTP/homestash/
And make the FTP directory non-writable.
chmod 555 /home/$USER/FTP
We’ll use the
homestash directory for our phone camera uploads.
500 OOPS: writable root inside chroot
If you are getting
Error message "500 OOPS: vsftpd: refusing to run with writable root inside chroot() on your connection, it is because your
local_root is writable. Follow the steps above to make it readable and use a sub-directory for uploads. Another solution is to allow the writable root on vsftpd by adding the next line to the configuration file:
Restart the vsftpd daemon
Apply all current changes by restarting the daemon.
sudo service vsftpd restart
Now the FTP server is up and running on your Raspberry Pi.
Secondly, HomeStash will be required. The app will automatically sync your pictures and videos between your smartphone and Raspberry Pi through the FTP server already made.
Use your RPi IP address as FTP host, the default
21 as a port, and your Raspberry Pi login credentials for FTP Username and Password. Now click
A folder structure will appear with our
homestash directory. Click on it and select
Choose current directory. If you have carefully followed the tutorial, you’ll have to choose which albums to backup as the final step.
Now, everything is set up and your files will automatically start to back up to the FTP server hosted on the Raspberry Pi.