← TUTORIAL
#ssh

Setting up a proftp server

updated 16 February 2015

ProFTPD is a configurable FTP server for Debian. This covers installation, user creation, and wiring it up with Apache so the FTP upload directory doubles as a web root.

Install proftpd

sudo apt-get install proftpd

Add /bin/false to /etc/shells so FTP-only users cannot get a login shell:

sudo nano /etc/shells

Append this line:

/bin/false

Create the FTP user and directory

cd /home
sudo mkdir FTPWEB
sudo useradd mbn -p your_password -d /home/FTPWEB -s /bin/false
sudo passwd mbn
sudo chmod 777 /home/FTPWEB

Configure proftpd

Open the configuration file:

sudo nano /etc/proftpd/proftpd.conf

Add a valid logins block and restrict access to the FTP directory:

# VALID LOGINS
AllowUser mbn
DenyAll

<Directory /home/FTP-shared>
  Umask 022 022
  AllowOverwrite off
  <Limit ALL>
    DenyAll
  </Limit>
</Directory>

Making Apache work with the FTPWEB folder

Install Apache and PHP:

sudo apt-get install apache2 php5

Open the default site configuration:

sudo nano /etc/apache2/sites-available/default

Change the document root from /var/www to /home/FTPWEB:

DocumentRoot /home/FTPWEB

Restart Apache:

sudo /etc/init.d/apache2 restart

Apache now serves files from /home/FTPWEB — it presents either the index file or a directory listing of whatever the FTP user has uploaded.