How To: Installing an FTP server on your Raspberry Pi
(Author: D.M. Wiig. Your comments and questions are welcomed.)
If you are running any of the Linux distributions on your Rpi it is a fairly simple process to install a basic FTP server. There are a number of very good FTP servers available for Linux with vsftpd being one of the most popular. This tutorial will discuss the specifics of a vsftpd server installation. The process would be very similar for other popular FTP servers.
For the sake of simplicity this tutorial will only cover the basic installation of vsftpd for anonymous mode. This means that any user can access the ftp server and download files without a login procedure. By default vsftpd is configured to allow anonymous access and download only. A future tutorial will discuss the setting of options for authentication mode and other client services.
To install vsftpd login to your Rpi and at the command prompt enter:
$ sudo apt-get install vsftpd
When the installation is complete you will see the line:
Starting FTP server: vsftpd
By default a directory for ftp users is created with a home directory of /srv/ftp. This is the default ftp directory. You can check to make sure the ftp server is up and running properly by doing the following:
From the command line issue the command:
$ cd /srv/ftp
Once you are in the ftp directory create a test file by using the following commands:
$ sudo nano ftpsamplefile
Nano is a fast and simple text editor for Raspian. When opened you will get a blank screen. Type in something like:
This is a sample file file loaded in the default ftp directory
/srv/ftp
4/1/14
After you have entered the text hit press Ctrl-o to save the file you have created and then Ctrl-x to exit nano after the line has been saved. Enter the following command in your Rpi to determine the local address of the Rpi:
sudo ifconfig
You will see a number of lines of information. One of the top lines should contain something like:
inet addr:192.xxx.x.xx
This sequence of numbers is the local network address of your Rpi. You can ftp to it from any device on your network, but at this point you are not connected to the outside world so you cannot connect to it from outside of your router and network without some additional steps. To test your installation, open a web browser on any device that you have connected to the same network as your Rpi and enter:
ftp://192.xxx.x.xx (substitute your address found with the ifconfig command for the x’s)
You should see the ftp user directory that will look something like the example below:
Index of /
Name |
Size |
Date Modified |
69 B |
3/31/13 8:05:00 PM |
The ftp folder will contain the sample file that you created previously. By clicking on the file you should see the contents:
This is a sample ftp file loaded in the directory /srv/ftp
Your FTP server is now up and running. I will cover issues such as file upload and download as well as creating user authentication and login procedures in another ‘How To:’