How to Install FTP Server on CentOS 7

r00t September 17, 2017

Install FTP Server on CentOS 7

In this tutorial we’ll learn how to install FTP Server on CentOS 7. We will also install and configure its prerequisites. The File Transfer Protocol (FTP) is a standard network protocol used to transfer computer files from one host to another host over a TCP-based network, such as the Internet or over LAN (Local Area Network). It is commonly used by most of the companies to share data with the customers.

I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an CentOS 7 minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.

Install FTP Server on CentOS 7

Step 1. First, ensure your system is fully up-to-date by running the following:

yum -y update
yum install epel-release

Step 2. Installing FTP Server in CentOS.

Open terminal and let’s install vsftpd and any required packages:

yum -y install vsftpd

Once the installation completes, start the service vsftpd and configure automatically from the next system boot:

systemctl start vsftpd
systemctl enable vsftpd

Next, in order to allow access to FTP services from external systems, we have to open port 21, where the FTP daemons are listening as follows:

firewall-cmd --zone=public --permanent --add-port=21/tcp
firewall-cmd --zone=public --permanent --add-service=ftp
firewall-cmd --reload

Step 3. Configuring and Securing FTP Server in Ubuntu.

First, we will create a backup of the original config file /etc/vsftpd/vsftpd.conf like so:

cp /etc/vsftpd.conf /etc/vsftpd.conf.orig

Next, open the /etc/vsftpd.conf file:

nano /etc/vsftpd.conf

Change the following lines:

# Controls whether anonymous logins are permitted or not.
anonymous_enable=NO

# Allow local users to login
local_enable=YES

# Set 'write_enable' to YES in order to allow changes to the filesystem
write_enable=YES

# to enable ASCII uploads (to prevent uploaded scripts etc. from breaking),
# without the DoS risk of SIZE and ASCII downloads. ASCII mangling should be
# on the client anyway..
ascii_upload_enable=YES
ascii_download_enable=YES

# You can set the root directory of the FTP users. if not specified, users' home directory equals FTP home directory
local_root=public_html

Save the file and close it. Then we have to restart VSFTPD services for the changes above to take effect:

systemctl restart vsftpd

Step 4. Create FTP users.

Let us create an user called “user1”.

useradd -M user1 –s /sbin/nologin
passwd user1

We will next set the home directory for “user1” by creating a new directory:

mkdir /var/www/godet
chmod 755 /var/www/godet

We have to provide access to the “user1” on FTP:

chown -R godet /var/www/user1

Now you can access the ftp server from other computers of same LAN via an ftp clients like filezilla or gftp, or just access (read only) by using a web browser. You have to use the username and password of the server.

Congratulation’s! You have successfully install and configured FTP server on your CentOS 7 server. Thanks for using this tutorial for installing FTP server on CentOS 7 system.

The Tags:

Leave a Comment

Comments are closed.