In this guide, we will see how to configure an FTP server (ProFTPd) to transfer files between your PC and your server.
A newly deployed Vultr CentOS server instance.
A Sudo user.
Update the system.
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.
sudo rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
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
sudo yum install proftpd
sudo yum install ftp
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 ...
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 : 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 ~ !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 a user.
useradd --shell /bin/false myuser
Create the home directory of our user "
Change the ownership of that directory to the user and group "
chown myuser:myuser /home/myuser/
Set a password for the user "