Hi there, Today I’ll explain to you how to set up the FTP server on centOS 8.
FTP is a well-known protocol used to transfer files between server and client. FTP uses TCP port 20 and 21. Follow the instructions below for the successful installation.
Before the following steps, you need to become the root of the server. Because service installation and configuration tasks need root privileges.
Step 01 – Install FTP Server on centOS 8
yum install vsftpd -y
vsftp means Very Secure FTP Daemon.
Step 02 – Start and Enable FTP Service
After Installation succeeds, we need to start & enable the FTP service. The following command will do it for you! Starting means service becomes available. Enabling means service will start on boot time.
systemctl start vsftpd
systemctl enable vsftpd
Step 03 – Configure the Firewall
After installing any service on centOS we need to configure the firewall for access the service from outside the server machine. Following command open ports on firewall for FTP service.
firewall-cmd –add-service=ftp –permanent
Step 04 – Configure the FTP main config file
Now the installing phase in completed. Its time to configure the main config file related to FTP service. This file is located in /etc/vsftpd/csftpd.conf . Just open it using vim or any text editor. I prefer vim.
add the following lines to the config file.
The First line means only the users in user_list file can access the ftp service. This make user management easier. Second line means user jailed into their home directory. If we don’t add the second line, then user able to access upper system directories(like root / directory).
Step 05 – Add a FTP user into system
FTP uses system users. Therefore, we need to add a new user to our system. The following command will add a user into centOS.
add a password to ftpuser.
Step 06 – Add ftp users into user_list file
In the main config file, we add the userlist_deny=NO line to allow users in the user_list file. Therefore we need to add our newly created user into the user_list file. Type the following command.
echo “ftpuser” | tee -a /etc/vsftpd/user_list
Step 07 – Configure the SELinux
SELinux is the additional security layer added into the centOS. We need to configure this layer to make ftp work properly. Use the following command.
setsebool -P tftp_home_dir on
Step 08 – Test the FTP Server
After the all above configs, then we can test our FTP server. By default centOS not included ftp utility. Therefore we need to install it.
yum install ftp -y
Now we can test the server.
That’s all about FTP on CentOS. In the next article, I’ll show you how to secure this server using an SSL certificate. If you have any questions, leave a comment below.