Root-Server Tutorial

ROOT-SERVER TUTORIAL

Installing and Configuring a ProFTPD Server on a Debian/Ubuntu Server

Learn how to install a ProFTPD Server on a Debian/Ubuntu server.

Author:

Zoey Löchner

Last updated:

26/11/2021

Introduction

This tutorial explains how to install and configure a ProFTPD server on a Debian or Ubuntu server and how to secure your FTP connection (FTPS).
I am doing this on a Debian 11 server (netcup RS 2000), but it should work on other Debian and Ubuntu versions as well.
This is an advanced version of https://github.com/SanCraftDev/Debian-Setup/blob/main/README.md#proftpd

Requirements

You need a Debian server with an internet connection that is accessible from the internet via a static IP on port 21.
You also need root permissions on your server.

Step 1 - Installing ProFTPD

First, connect to your server via SSH.
After that, we switch to the root user to update the system and afterwards we'll install the ProFTPD server.

su
apt update && apt upgrade -y && apt autoremove -y
apt install wget curl sudo nano proftpd openssl -y
addgroup ftpuser

On Debian 11, you also have to run this command:

apt install proftpd-mod-crypto

Step 2 - Configuring ProFTPD

Open the ProFTPD configuration file:

nano /etc/proftpd/proftpd.conf

Press CTRL + W and enter Group nogroup to search for the desired line. Replace this line with Group ftpuser:

- Group nogroup
+ Group ftpuser

Press CTRL + W and enter #Include /etc/proftpd/tls.conf to search for the desired line. Replace this line with Include /etc/proftpd/tls.conf:

- #Include /etc/proftpd/tls.conf
+ Include /etc/proftpd/tls.conf

Now add this text at the beginning of the file:

<Global>
  RequireValidShell  off
  RootLogin  off
  DefaultRoot ~
</Global>
 
<Limit LOGIN>
  DenyGroup  !ftpuser
</Limit>

Save your changes by pressing CTRL + X, then by pressing y and finally by hitting ENTER.

Open the ProFTPD modules file

nano /etc/proftpd/modules.conf

Now go to the beginning of the file and insert this line there:

LoadModule mod_tls.c

Step 3 - Securing via SSL

To make the connection more secure we need to enable FTPS.
For this, we first save the original FTPS configuration, create an SSL Certificate and then create the new configuration.

cd /etc/proftpd/
mv tls.conf tls.conff
openssl req -x509 -newkey rsa:8096 -keyout /etc/ssl/private/proftpd.key -out /etc/ssl/certs/proftpd.crt -nodes -days 999999

Now you are asked some questions which you can answer directly or by entering a period (.)

chmod 0640 /etc/ssl/private/proftpd.key

Open the tls.conf:

nano tls.conf

And paste this text here:

<IfModule mod_tls.c>
TLSEngine                               on
TLSLog                                  /var/log/proftpd/tls.log
TLSProtocol                             SSLv123 TLSv1
TLSRSACertificateFile                   /etc/ssl/certs/proftpd.crt
TLSRSACertificateKeyFile                /etc/ssl/private/proftpd.key
TLSOptions                              NoCertRequest EnableDiags NoSessionReuseRequired
TLSVerifyClient                         off
TLSRequired                             on
TLSRenegotiate                          required off
</IfModule>

Now we need to restart ProFTPD:

service proftpd restart

Step 4 - Creating an FTP user

In the next command, replace USERNAME with a valid username and PATH with the path to which the user should have access:

adduser USERNAME --shell /bin/false --home /PATH --ingroup ftpuser

Conclusion

With the aid of this tutorial, you set up an FTP server with encryption.
This is an advanced version of https://github.com/SanCraftDev/Debian-Setup/blob/main/README.md#proftpd

License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Contributor's Certificate of Origin

By making a contribution to this project, I certify that:

  1. The contribution was created in whole or in part by me and I have the right to submit it under the license indicated in the file; or

  2. The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same license (unless I am permitted to submit under a different license), as indicated in the file; or

  3. The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.

  4. I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the license(s) involved.

Published 26/11/2021 by Zoey Löchner

Submit your tutorial

Get 60€ netcup vouchers for every published tutorial.