FTP (File Transfer Protocol) is a network protocol used for transfering files between a client and a server. It handles very well and fast transfer of thousands of small files or several big ones. It offers the choice of using FTPS for encrypting transfers however more modern alternatives are available such as scp or SFTP.
ProFTPD (short for Pro FTP daemon) is a powerful FTP server software. It is very easy to configure as well. In this article, we are going to show you how to install ProFTPd with TLS on Ubuntu 20.04 (Focal Fossa).
ProFTPD is a free and open-source software for Unix and Unix-like operating systems. ProFTPD is developed, released and distributed under the GNU Public License (GPL). It is a versatile FTP server that supports TLS (SSL) for secure connections.
ProFTPD offers the following features, with many more planned:
- Single main configuration file, with directives and directive groups which are intuitive to any administrator who has ever used the Apache web server
- Per directory “.ftpaccess” configuration similar to Apache’s “.htaccess”
- Easy to configure multiple virtual FTP servers and anonymous FTP services
- Designed to run either as a stand-alone server or from inetd/xinetd, depending on system load
- Anonymous FTP root directories do not require any specific directory structure, system binaries or other system files
- No SITE EXEC command. In modern Internet environments, such commands are a security nightmare
- Source code is available (and must always be available) for administrators and developers to audit
- Hidden directories and files, based on Unix-style permissions or user/group ownership
- Runs as a configurable non-privileged user in stand-alone mode in order to decrease chances of attacks which might exploit its “root” abilities. Note: This feature is dependent on the capabilities of the host Unix system
- Logging and utmp/wtmp support. Logging is compatible with the wu-ftpd standard, with extended logging available
- Shadow password suite support, including support for expired accounts
- Modular design, allowing server to be extended easily with modules. Modules have been written for SQL databases, LDAP servers, SSL/TLS encryption, RADIUS support, etc.
- IPv4 and IPv6 support
- A server running Ubuntu 20.04
- A static IP address 192.168.0.134 is set up on server
- A root password is set up on your server
Updating your system
Run the following command to update your Ubuntu to the latest version:
sudo apt-get update -y sudo apt-get upgrade -y
Once updated, restart your server to apply the changes. Alternatively, you may use the LivePatch service and avoid the reboot.
How to install ProFTPD
ProFTPD is available in the Ubuntu 20.04 default repository by default. Run the following command to install it:
sudo apt-get install proftpd -y
Then start ProFTPD service and enable it to start automatically a boot time:
systemctl start proftpd systemctl enable proftpd
Verify the status of ProFTPD service:
systemctl status proftpd
The following output should be returned:
proftpd.service - LSB: Starts ProFTPD daemon Loaded: loaded (/etc/init.d/proftpd; generated) Active: active (running) since Sat 2020-06-20 15:09:08 EEST; 1min 9s ago Docs: man:systemd-sysv-generator(8) Tasks: 1 (limit: 3525) Memory: 2.3M CGroup: /system.slice/proftpd.service └─3529 proftpd: (accepting connections) iun 20 15:09:08 f-VirtualBox20 systemd: Starting LSB: Starts ProFTPD daemon... iun 20 15:09:08 f-VirtualBox20 proftpd: * Starting ftp server proftpd iun 20 15:09:08 f-VirtualBox20 proftpd: 2020-06-20 15:09:08,609 f-VirtualBox20 proftpd: processing configuration directory '/etc/proftpd/conf.d/' iun 20 15:09:08 f-VirtualBox20 proftpd: ...done. iun 20 15:09:08 f-VirtualBox20 systemd: Started LSB: Starts ProFTPD daemon.
Please remember that the default configuration files of ProFTPD is located at /etc/proftpd/proftpd.conf. You can view its content with the following command:
The following output should be returned:
# # /etc/proftpd/proftpd.conf -- This is a basic ProFTPD configuration file. # To really apply changes, reload proftpd after modifications, if # it runs in daemon mode. It is not required in inetd/xinetd mode. # # Includes DSO modules Include /etc/proftpd/modules.conf # Set off to disable IPv6 support which is annoying on IPv4 only boxes. UseIPv6 on # If set on you can experience a longer connection delay in many cases. IdentLookups off ServerName "Debian" # Set to inetd only if you would run proftpd by inetd/xinetd. # Read README.Debian for more information on proper configuration. ServerType standalone DeferWelcome off MultilineRFC2228 on DefaultServer on ShowSymlinks on TimeoutNoTransfer 600 TimeoutStalled 600 TimeoutIdle 1200 DisplayLogin welcome.msg DisplayChdir .message true ListOptions "-l" DenyFilter \*.*/ # Use this to jail all users in their homes # DefaultRoot ~ # Users require a valid shell listed in /etc/shells to login. # Use this directive to release that constrain. # RequireValidShell off # Port 21 is the standard FTP port. Port 21 # In some cases you have to specify passive ports range to by-pass # firewall limitations. Ephemeral ports can be used for that, but # feel free to use a more narrow range. # PassivePorts 49152 65534 # If your host was NATted, this option is useful in order to # allow passive tranfers to work. You have to use your public # address and opening the passive ports used on your firewall as well. # MasqueradeAddress 220.127.116.11 # This is useful for masquerading address with dynamic IPs: # refresh any configured MasqueradeAddress directives every 8 hours <IfModule mod_dynmasq.c> # DynMasqRefresh 28800 </IfModule> # To prevent DoS attacks, set the maximum number of child processes # to 30. If you need to allow more than 30 concurrent connections # at once, simply increase this value. Note that this ONLY works # in standalone mode, in inetd mode you should use an inetd server # that allows you to limit maximum number of processes per service # (such as xinetd) MaxInstances 30 # Set the user and group that the server normally runs at. User proftpd Group nogroup # Umask 022 is a good standard umask to prevent new files and dirs # (second parm) from being group and world writable. Umask 022 022 # Normally, we want files to be overwriteable. AllowOverwrite on # Uncomment this if you are using NIS or LDAP via NSS to retrieve passwords: # PersistentPasswd off # This is required to use both PAM-based authentication and local passwords # AuthOrder mod_auth_pam.c* mod_auth_unix.c # Be warned: use of this directive impacts CPU average load! # Uncomment this if you like to see progress and transfer rate with ftpwho # in downloads. That is not needed for uploads rates. # # UseSendFile off TransferLog /var/log/proftpd/xferlog SystemLog /var/log/proftpd/proftpd.log # Logging onto /var/log/lastlog is enabled but set to off by default #UseLastlog on # In order to keep log file dates consistent after chroot, use timezone info # from /etc/localtime. If this is not set, and proftpd is configured to # chroot (e.g. DefaultRoot or <Anonymous>), it will use the non-daylight # savings timezone regardless of whether DST is in effect. #SetEnv TZ :/etc/localtime <IfModule mod_quotatab.c> QuotaEngine off </IfModule> <IfModule mod_ratio.c> Ratios off </IfModule> # Delay engine reduces impact of the so-called Timing Attack described in # http://www.securityfocus.com/bid/11430/discuss # It is on by default. <IfModule mod_delay.c> DelayEngine on </IfModule> <IfModule mod_ctrls.c> ControlsEngine off ControlsMaxClients 2 ControlsLog /var/log/proftpd/controls.log ControlsInterval 5 ControlsSocket /var/run/proftpd/proftpd.sock </IfModule> <IfModule mod_ctrls_admin.c> AdminControlsEngine off </IfModule> # # Alternative authentication frameworks # #Include /etc/proftpd/ldap.conf #Include /etc/proftpd/sql.conf # # This is used for FTPS connections # #Include /etc/proftpd/tls.conf # # Useful to keep VirtualHost/VirtualRoot directives separated # #Include /etc/proftpd/virtuals.conf # A basic anonymous configuration, no upload directories. # <Anonymous ~ftp> # User ftp # Group nogroup # # We want clients to be able to login with "anonymous" as well as "ftp" # UserAlias anonymous ftp # # Cosmetic changes, all files belongs to ftp user # DirFakeUser on ftp # DirFakeGroup on ftp # # RequireValidShell off # # # Limit the maximum number of anonymous logins # MaxClients 10 # # # We want 'welcome.msg' displayed at login, and '.message' displayed # # in each newly chdired directory. # DisplayLogin welcome.msg # DisplayChdir .message # # # Limit WRITE everywhere in the anonymous chroot # <Directory *> # <Limit WRITE> # DenyAll # </Limit> # </Directory> # # # Uncomment this if you're brave. # # <Directory incoming> # # # Umask 022 is a good standard umask to prevent new files and dirs # # # (second parm) from being group and world writable. # # Umask 022 022 # # <Limit READ WRITE> # # DenyAll # # </Limit> # # <Limit STOR> # # AllowAll # # </Limit> # # </Directory> # # </Anonymous> # Include other custom configuration files # !! Please note, that this statement will read /all/ file from this subdir, # i.e. backup files created by your editor, too !!! # Eventually create file patterns like this: /etc/proftpd/conf.d/*.conf # Include /etc/proftpd/conf.d/
You may change the above setting according to your requirements:
ServerName: You can change it as your default server name
UseIPV6: You can disable it by changing it to off
DefaultRoot: You can uncomment this line to restrict users with their home folders
Port: You can run ProFTPD on a custom port by changing it this line
SystemLog: The default location of the log file. You can change it as per your requirements
How to secure ProFTPD with TLS
ProFTPD is now installed. Next, let’s configure ProFTPD with TLS for secure FTP connections.
Run the following command to install OpenSSL to your server:
sudo apt-get install openssl -y
Then run the following command to generate a SSL certificate to use with ProFTPD:
sudo openssl req -x509 -newkey rsa:1024 -keyout /etc/ssl/private/proftpd.key -out /etc/ssl/certs/proftpd.crt -nodes -days 365
Answer all the questions as shown below:
enerating a RSA private key .+++++ .....................+++++ writing new private key to '/etc/ssl/private/proftpd.key' ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]:UK State or Province Name (full name) [Some-State]:UK Locality Name (eg, city) :London Organization Name (eg, company) [Internet Widgits Pty Ltd]:none Organizational Unit Name (eg, section) :IT Common Name (e.g. server FQDN or YOUR name) :myserver Email Address :
This command will output two files: /etc/ssl/private/proftpd.key and /etc/ssl/certs/proftpd.crt.
Execute the below command to ensure the proper permissions for SSL files:
chmod 600 /etc/ssl/private/proftpd.key chmod 600 /etc/ssl/certs/proftpd.crt
How to configure ProFTPD to use SSL
In order to use secure connections with Pro FTPD you need to edit the /etc/proftpd/proftpd.conf file:
sudo nano /etc/proftpd/proftpd.conf
Uncomment the following line:
Save and close the file. Open /etc/proftpd/tls.conf file:
sudo nano /etc/proftpd/tls.conf
Add the following lines if they are not already in the config file or edit the existing lines as mentioned below:
TLSRSACertificateFile /etc/ssl/certs/proftpd.crt TLSRSACertificateKeyFile /etc/ssl/private/proftpd.key TLSEngine on TLSLog /var/log/proftpd/tls.log TLSProtocol SSLv23 TLSRequired on TLSOptions NoCertRequest EnableDiags NoSessionReuseRequired TLSVerifyClient off
Save and close the file then restart the PureFTPD service:
sudo systemctl restart proftpd
How to create a user for ProFTPD
Run the following command to create a ProFTPD user to access the server:
sudo adduser ftpuser1
Answer all the questions as shown below:
Adding user `ftpuser1' ... Adding new group `ftpuser1' (1001) ... Adding new user `ftpuser1' (1001) with group `ftpuser1' ... Creating home directory `/home/ftpuser1' ... Copying files from `/etc/skel' ... New password: Retype new password: passwd: password updated successfully Changing the user information for ftpuser1 Enter the new value, or press ENTER for the default Full Name : JOHN Room Number : LONDON Work Phone : Home Phone : Other : Is the information correct? [Y/n] y
How to access ProFTPD Server using FileZilla
We are going to access ProFTPD through FileZilla from the Client system.
Install FileZilla on your Client system by running the following command:
apt-get install filezilla -y
When installation has been completed, open the FileZilla from Unity dash. Here, click on the Site Manager on the left side panel and create a new site. Provide your FTP server IP address, select protocol, select Encryption, select logon type, provide username and password. Then, click on the Connect button.
On the following page accept the certificate, tick mark “Always trust certificate in future sessions” and click on the OK button. The following page will allow you to transfer files securely via SSL/TLS.
Now you know how to install and configure ProFTPD server and how to secure it with SSL/TLS encryption.