FTP (File Transfer Protocol) is a popular protocol used for transferring files between a client and server over a network. In this tutorial, we will guide you through the process of installing and configuring an FTP server on an Almalinux system.
Step 1: Install vsftpd Package The first step is to install the vsftpd package using the following command in the terminal:
sudo dnf install vsftpd -y
Step 2: Configure Firewall By default, the FTP server listens on port 21. To allow FTP traffic through the firewall, we need to add the firewall rule using the following command:
sudo firewall-cmd --add-service=ftp --permanent
sudo firewall-cmd --reload
Step 3: Configure FTP server Once the package has been installed and the firewall rule has been added, we need to configure the FTP server. To do this, we will edit the vsftpd configuration file:
sudo vi /etc/vsftpd/vsftpd.conf
The configuration file contains a lot of settings. We will cover the most important ones below:
- anonymous_enable: This option allows anonymous users to connect to the FTP server. We will set this to NO since we want to restrict access to authenticated users only.
- local_enable: This option allows local users to connect to the FTP server. We will set this to YES since we want to allow local users to connect.
- write_enable: This option allows users to upload files to the server. We will set this to YES since we want to allow users to upload files.
- chroot_local_user: This option restricts users to their home directory. We will set this to YES for security reasons.
Make sure to uncomment these options by removing the ‘#’ sign at the beginning of each line.
Once you have made the necessary changes, save and close the file.
Step 4: Create FTP User To allow users to connect to the FTP server, we need to create a user account. To do this, use the following command:
sudo useradd ftpuser
Next, set a password for the user using the following command:
sudo passwd ftpuser
Step 5: Restart FTP Server Now that the FTP server is configured and the user account has been created, we need to restart the FTP server to apply the changes. Use the following command to restart the FTP server:
sudo systemctl restart vsftpd
Step 6: Test FTP Server To test the FTP server, we can use an FTP client such as FileZilla. Install FileZilla on your client machine and open it. Enter the server IP address, username, and password and click Connect.
You should now be connected to the FTP server, and you should be able to upload and download files.
Conclusion
In this tutorial, we showed you how to install and configure an FTP server on an Almalinux system. By following these steps, you can set up an FTP server that allows users to transfer files securely over a network.
A beginner’s guide to using the AlmaLinux command line interface