FTP (File Transfer Protocol) server is a crucial tool for transferring files between computers on a network. CentOS 7, a popular server operating system, offers robust support for setting up an FTP server. In this article, you will learn how to install and configure an FTP server on CentOS 7 step by step.
Prerequisites
Before starting the installation, make sure your system is updated using the command sudo yum update
, and you have administrative privileges to perform the installation.
Installing vsftpd
The first step is to install vsftpd
(Very Secure FTP Daemon), which is a popular and secure FTP server for Linux. You can install it using the following command:
sudo yum install vsftpd -y
Configuring vsftpd
After installation, it's necessary to modify the vsftpd
configuration file to ensure the security and efficiency of the server. You can find the configuration file at /etc/vsftpd/vsftpd.conf
. Use any text editor of your choice, such as nano
, for edits:
sudo nano /etc/vsftpd/vsftpd.conf
Here are some recommended changes in the configuration file:
- anonymous_enable=NO – Disables anonymous access.
- local_enable=YES – Enables access to local users.
- write_enable=YES – Allows writing to the server for authenticated users.
- chroot_local_user=YES – Restricts users to their home directory.
After making the changes, save and close the file.
Enabling and Starting vsftpd
To ensure the FTP server starts on system boot, use the command:
sudo systemctl enable vsftpd
Then start the server using the command:
sudo systemctl start vsftpd
You can check the status of the server using:
sudo systemctl status vsftpd
Firewall Configuration
For the FTP server to function correctly, you need to allow FTP traffic in the firewall. If you're using firewalld
, you can perform the following settings:
sudo firewall-cmd --permanent --add-service=ftp
sudo firewall-cmd --reload
Testing the FTP Server
After configuration and service restarts, it's good to test the server. From another computer in the same network, try to connect to the FTP server using an FTP client like FileZilla or directly from the command line:
ftp your-server-ip-address
If everything was done correctly, you should be prompted to enter a username and password.
You now have a functional FTP server on CentOS 7. With proper configuration and regular maintenance, vsftpd will provide a reliable platform for file transfers between computers in your network. Remember to keep your system and applications updated regularly to ensure their security and stability.