Installing an FTP server

Installation

FTP (File Transfer Protocol) is a communication protocol designed to exchanged files on the TCP/IP network. Using a computer, it enables you to copy files to another network computer.

Let's see how you can set up an FTP service on a Gandi virtual machine.

The first step is to install ProFTP on the server

apt-get install proftpd

It is preferable to continue the installation in standalone, this way the FTP server will always be receptive. If you choose inetd, the FTP server will only be launched when a connexion is initialized.

Parameters

Using a text editor such as nano, edit the file called shells in the /etc/ directory and a line: ”/bin/false/”, as shown below:

Nano enables you to edit your text documents (like a more intuitive vi). You can install it by using the apt-get install nano command.

For our example, let's create ftp folders and the upload and download sub domains, with 'read only' rights on download and 'read/write' for upload, so that users can upload files.

cd /home/ftp/
mkdir download upload
cd /home
sudo chmod 755 ftp
cd ftp
chmod 755 download
chmod 777 upload

Now that the folders and rights are sorted, let's create a “gandi” account which will have access to the FTP

useradd gandi -p votre_mot_de_passe -d /home/ftp -s /bin/false
passwd gandi

Now all that's left is to edit the /etc/proftpd/proftpd.conf file with nano to modify your server configuration (port address, server name, number of people who can connect…)

Launch the server using the following command:

sudo /etc/init.d/proftpd start

To stop it, replace start by stop, and use restart to… restart!


When your server has just been created, you may have the following error:

unable to set LC_ALL: No such file or directory -
Fatal: unable to load module 'mod_lang.c': Operation not permitted
failed!

To fix that problem, you just have to reconfigure locales packages :
dpkg-reconfigure locales

Then, set all languages packages in spite of the country you live in, and this error won't be any more.

Last modified: 12/17/2009 at 09:50 by Rudy g. (Gandi)