How to Install and Use ProFTPd on a CentOS Cloud Server?

06-02-2024 02:30:50

FTP software is used for the transfer of files between a client and a server. ProFTPd is a popular FTP application, and this guide explains the steps for installing and using ProFTPd on a CentOS cloud server.

Execute the following commands to install the ProFTPd software.

sudo yum install epel-release
sudo yum install proftpd
sudo yum install ftp

Edit the ProFTPd configuration file.

sudo nano /etc/proftpd.conf

The content is as follows.

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

Add an FTP user and set a password, using "myuser" as an example.

useradd --shell /bin/false myuser
passwd myuser

Create a user directory and set ownership permissions.

mkdir /home/myuser
chown myuser:myuser /home/myuser/

Finally, test the ability to upload and download files using an FTP client. The "ftpwho" command can be used to display information about all currently logged-in FTP users.