Friday, December 21, 2018

How to Create FTP Server with Raspberry Pi


Raspberry Pi revolutionised electronics and computer hobby nearly 6 years. Too many creative project has been created with this tiny computer. On this simple tutorial, we'll create a simple FTP server with Raspberry Pi.





This tutorial as intended to Raspberry Pi 3 Model B user, but it also practicable to other version of Raspberry Pi with some modification.





You will need:





  • a Raspberry Pi 3 Model B or other version,
  • a SD Card with the latest Raspbian/ARMbian images or other Debian-based distribution for Raspberry Pi
  • Power supply
  • Keyboard or monitor or LCD




Install FTP Server





You must set your IP Address as static IP. To know your ip address, use command like 'ifconfig'. You also need to enable and start SSH Server for more easy to use in the future.





Install vsftpd using this command:





sudo apt-get update
sudo apt-get install vsftpd




Configure FTP Server





the default FTP server is located in /etc/vsftpd.conf.





Configure and tweak your ftp server by modifying some of those parameters. My suggesstion is enable this parameters, remove the # symbol on every lines that match following parameters:





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




then add some lines to the end of file:





user_sub_token=$USER
local_root=/home/$USER/ftp




Save and exit (in Nano you can use Ctrl + O and Ctrl + X





Last but not least, you can create the user FTP directory:





mkdir /home/pi/ftp
mkdir /home/pi/ftp/files
chmod a-w /home/pi/ftp




You can create new user account by using adduser command and create their FTP directory like the above commands.





Done.


0 comments:

Post a Comment