How to Install FTP Server on CentOS 7

centos logo

In this article, we will have explained the necessary steps to install and configure FTP Server on CentOS 7. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

FTP (File Transfer Protocol) is a traditional and widely used standard tool for transferring files between a server and clients over a network, especially where no authentication is necessary (permits anonymous users to connect to a server). We must understand that FTP is insecure by default because it transmits user credentials and data without encryption.

Install FTP Server on CentOS 7

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

sudo yum install epel-release
sudo yum update

Step 2. Installing FTP Server on CentOS.

Install vsftpd server is straight forward, just run the following command in the terminal:

sudo yum install vsftpd

Once the package is installed, start the vsftpd daemon and enable it to automatically start at boot time:

sudo systemctl start vsftpd
sudo 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 FTP Server.

Configuration file will be in /etc/vsftp folder. Vsftpd.conf is the configuration file of FTP server:

sudo nano /etc/vsftpd/vsftpd.conf

Set the following options with these corresponding values:

anonymous_enable=NO             # disable  anonymous login
local_enable=YES		# permit local logins
write_enable=YES		# enable FTP commands which change the filesystem
local_umask=022		        # value of umask for file creation for local users
dirmessage_enable=YES	        # enable showing of messages when users first enter a new directory
xferlog_enable=YES		# a log file will be maintained detailing uploads and downloads
connect_from_port_20=YES        # use port 20 (ftp-data) on the server machine for PORT style connections
xferlog_std_format=YES          # keep standard log file format
listen=NO   			# prevent vsftpd from running in standalone mode
listen_ipv6=YES		        # vsftpd will listen on an IPv6 socket instead of an IPv4 one
pam_service_name=vsftpd         # name of the PAM service vsftpd will use
userlist_enable=YES  	        # enable vsftpd to load a list of usernames
tcp_wrappers=YES  		# turn on tcp wrappers

That’s all you need to do to install FTP Server on CentOS 7. I hope you find this quick tip helpful. For further reading on FTP, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.