Although FTP (File Transfer Protocol) is an old technology it is still used by lots of systems and hardware devices. Some IP cameras allow you to save photos to an FTP server and you can create one using a Raspberry Pi. If you’ve got the choice you would be better using SFTP but if your device only supports FTP then this guide will help you create an FTP server.
We will use vsftpd as it is a popular Linux appication that is secure, stable and extremely fast.
Initial Setup
You will need :
-----------------------------------
A Raspberry Pi
SD card with latest Raspbian image
Power supply
Keyboard and Monitor (optional)-----------------------------------
SD card with latest Raspbian image
Power supply
Keyboard and Monitor (optional)-----------------------------------
Start off with a fresh SD card containing the latest Raspbian image. The How to Create a New SD Card for Raspberry Pi on Windows guide will explain how to do this on Windows. Setup your Pi and get it connected to your network using Ethernet or WiFi. If you want to do the FTP setup remotely then follow this guide to enable SSH.
Obtain the network IP address using :
ifconfig
It will most probably be of the form 192.168.###.###.
Step 1 – Install vsftpd
Use the following command to update your repositories and install the vsftpd software :
sudo apt-get update
sudo apt-get install vsftpd
Step 2 – Update Configuration File
Once installed you can now edit the vsftpd configuration file using :
sudo nano /etc/vsftpd.conf
In this file find the following lines and un-comment them by deleting the # character :anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
chroot_local_user=YES
Add the following lines to the end of the file :user_sub_token=$USER
local_root=/home/$USER/ftp
Save and exit using CTRL-X, Y and ENTER.
Step 3 – Create FTP Directory for Pi User
To allow you to connect to the FTP server using the default Pi user we need to create a few directories :
mkdir /home/pi/ftp
mkdir /home/pi/ftp/files
Change the permissions on the ftp directory using :chmod a-w /home/pi/ftp
That's it - you are done, now use a FTP client - connect to the IP of your Raspberry
Comments
Post a Comment