Learn How To Install an FTP Server With ProFTPd on CentOS 6 or CentOS 7

December 25, 2019

Table of Contents

If you are using a different system, please check our other tutorials.

In this guide, we will see how to configure an FTP server (ProFTPd) to transfer files between your PC and your server.

Prerequisites

  • A newly deployed IT Web Services CentOS server instance.
  • A sudo user.

Installation

Update the system.

yum check-update

Official RHEL/CentOS 6/7 repositories do not provide any binary packages for ProFTPD Server, so you need to add extra package repositories on your system provided by EPEL 6/7 repo using one of the following commands.

CentOS 6:

sudo rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

CentOS 7:

sudo rpm -Uvh http://ftp.astral.ro/mirrors/fedora/pub/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm

Download all of the metadata for the currently enabled yum repos.

sudo yum makecache

Install proftpd.

sudo yum install proftpd

Install ftp.

sudo yum install ftp

Configuration

Open the ProFTPd configuration file.

sudo nano /etc/proftpd.conf

The file will resemble the following text.

The file will resemble the following text.
# This is the ProFTPD configuration file
#
# See: http://www.proftpd.org/docs/directives/linked/by-name.html
# Server Config - config used for anything outside a <VirtualHost> or <Global> $
# See: http://www.proftpd.org/docs/howto/Vhost.html
ServerName                      "ProFTPD server"
ServerIdent                     on "FTP Server ready."
ServerAdmin                     root@localhost
DefaultServer                   on
# Cause every FTP user except adm to be chrooted into their home directory
# Aliasing /etc/security/pam_env.conf into the chroot allows pam_env to
# work at session-end time (http://bugzilla.redhat.com/477120)
VRootEngine                     on
DefaultRoot                     ~ !adm
VRootAlias                      /etc/security/pam_env.conf etc/security/pam_env$
# Use pam to authenticate (default) and be authoritative
AuthPAMConfig                   proftpd
AuthOrder                       mod_auth_pam.c* mod_auth_unix.c
# If you use NIS/YP/LDAP you may need to disable PersistentPasswd
#PersistentPasswd               off
# Don't do reverse DNS lookups (hangs on DNS problems)
UseReverseDNS                   off
# Set the user and group that the server runs as
User                            nobody
Group                           nobody
# To prevent DoS attacks, set the maximum number of child processes
# to 20.  If you need to allow more than 20 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                    20
...

Main configuration directives

  • ServerName: Specifies the name of the FTP server. This name will be displayed when clients connect to the server.
  • DefaultRoot: Controls the default root directory assigned to a user upon login.
  • MaxInstances: The maximum number of simultaneous connections you want to allow on your FTP server.

Now, we have to change the ServerName.

ServerName : the name of your FTP server

Note: By default, someone who connects to the FTP server can access all of the server folders, so it’s recommended to enable the option DefaultRoot.

DefaultRoot                     ~ !adm

After the configuration has been changed, restart the server.

sudo service proftpd restart

Note: If an error line is displayed as “unable to resolve host“, be aware that it does not matter and you can ignore it.

Add an FTP user

Add a user.

useradd --shell /bin/false myuser

Create the home directory of our user “myuser“.

mkdir /home/myuser

Change the ownership of that directory to the user and group “myuser“.

chown myuser:myuser /home/myuser/

Set a password for the user “myuser“.

passwd myuser

Connect to your FTP server

Now that your FTP server is installed and configured, you would like to be able to connect to it.

Just type ftp://server_ip_address in the address bar of your browser. Replace server_ip_address with the IP address of your server. You will then be asked for your username and password.

You can see who is connected to your FTP server with the following command.

ftpwho

You can also see statistics.

ftpstats

Need help?

Do you need help setting up this on your own service?
Please contact us and we’ll provide you the best possible quote!