In this article, we will have explained the necessary steps to install and configure FTP Server on CentOS 8. 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 8
Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.
sudo dnf install epel-release sudo dnf update
Step 2. Install FTP Server on the CentOS system.
Now, install vsftpd with the following command:
sudo dnf install vsftpd
Once the package is installed, start the vsftpd daemon and enable it to start at boot time automatically:
sudo systemctl start vsftpd sudo systemctl enable vsftpd sudo systemctl status vsftpd
Step 3. Configuring FTP Server.
The configuration file will be in
/etc/vsftp the folder. Vsftpd.conf is the configuration file of the 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
Step 4. Configure Firewall.
If you are running a firewall, you need to allow these salient ports 21 (FTP command port), port 20 (FTP data port) and 30000-31000 (Passive ports range):
sudo firewall-cmd --permanent --add-port=20-21/tcp sudo firewall-cmd --permanent --add-port=30000-31000/tcp firewall-cmd --reload
Step 5. Create an FTP user and its directory
We will create a user that we will use to access the FTP server:
sudo adduser ftpuser sudo passwd ftpuser
Next, we will proceed and create the FTP directory and assign the following permissions and directory ownership:
sudo mkdir -p /home/ftpuser/ftp_dir sudo chmod -R 750 /home/ftpuser/ftp_dir sudo chown -R ftpuser: /home/ftpuser/ftp_dir
Step 6. Test your vsftpd or FTP server.
Your FTP server is fully functional, and you should be able to connect to your server with any FTP client that can be configured to use TLS encryption such as FileZilla.
That’s all you need to do to install FTP Server on CentOS 8. I hope you find this quick tip helpful. For further reading on FTP Server, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.