How to Configure an VSFTP Server on the Raspberry Pi for Transferring Files on a LAN

I needed to transfer a file from my RPi to my main computer, but I didn't want to plug in a USB drive given that all my USB ports on my RPi are in use.

After googling, I came accross a wikihow, which I will liberally reproduce here. It involves the use of the vsftpd FTP server, which stands for Very Secure FTP Daemon.

Execute the following:

sudo chown -R pi /var/www  
sudo apt-get install vsftpd  
sudo nano /etc/vsftpd.conf

In your vsftpd configuration file, do the following: "Change anonymous_enable=YES to anonymous_enable=NO, Uncomment local_enable=YES and write_enable=YES, then go to the bottom of the file and add force_dot_files=YES. Now save and exit the file."

Finally, execute the following:

sudo service vsftpd restart

Now, on your home computer you can open up FileZilla or your preferred FTP client and connect to your RPi by entering your RPI's IP address. To get your IP, execute "ifconfig":

matthew_moisen_raspberrypi_ifconfig

Now use your IP, your username and password to FTP into your RPi from your preferred FTP client:

matthew_moisen_raspberrypi_ftp

To stop your FTP server, execute the following:

sudo service vsftpd stop

UPDATE:

I recently had to transfer a file but was unable to connect through FileZilla.
This surprised me, as my RPi has not been turned off since I wrote this post. I executed the following and was able to connect again:

sudo service vsftpd restart

It is probably best to issue sudo nano /etc/rc.local and add the following line before _ex_it(0):

sudo service vsftpd restart

Comments

Add Comment

Name

Email

Comment

Are you human? - seven = 1


Name: urswin riffel

Creation Date: 2016-05-18

Can you maybe create a walk through on how to create a file server over wifi on the rapsberry pi(where the pi is the router), that i can access via my phones chrome on my phone wifi


Name: Dennis

Creation Date: 2016-09-30

Great howto! If you still need an elegant solution to ensure your FTP server is up when you need it, I found the following helpful: Use “xinetd” to start the FTP service in normal mode. This helps to keep the FTP service alive. sudo service vsftpd stop To Stop vsFTP from running in standalone mode then install xinetd (if it is not installed already) sudo apt-get install xinetd Next, create a file called vsftpd in /etc/xinetd.d/ with the following content: service ftp { disable = no sockettype = stream wait = no user = /usr/sbin/vsftpd persource = 5 instances = 200 noaccess = 192.168.1.0/24 #use this to block any connections from this network onlyfrom = 192.168.1.0/24 #use this to allow connections only from this network bannerfail = /etc/vsftpd.busy logonsuccess += PID HOST DURATION logon_failure += HOST } Please alter any of these options to match your system configurations. server – to get the correct path to enter here, type “which vsftpd” on the terminal noaccess – this will block any host or hosts defined here bannerfail – this should the path to the file with the text to show to any blocked IP address Open the file /etc/vsftpd.conf and change listen=YES to listen=NO This instructs the FTP server not to open any ports but let “xinetd” control and manage the entire ports and services. sudo service xinetd start This will start vsFTP in normal mode and will keep it running. As a bonus, it will autostart after the next reboot.