How to Set Up an FTP Server on CentOS 7

How to Set Up an FTP Server on CentOS 7

Setting up an FTP (File Transfer Protocol) server on CentOS 7 can be a valuable skill for anyone dealing with file management or website hosting. FTP allows for the easy and secure transfer of files between a server and a client. In this guide, we will walk you through the step-by-step process of setting up an FTP server on CentOS 7, ensuring a seamless file transfer experience.


Before diving into the installation process, make sure you have the following prerequisites:

  1. A CentOS 7 server with root access.
  2. A stable internet connection.
  3. Basic knowledge of using the Linux command line.

Step 1: Update System Packages

To begin, it's essential to ensure that your system is up-to-date. Open your terminal and run the following commands:

sudo yum update

This will update all the packages on your CentOS 7 system.

Step 2: Install vsftpd (Very Secure FTP Daemon)

The next step is to install the vsftpd package, which is a fast and secure FTP server for Unix-like systems. Execute the following command in your terminal:

sudo yum install vsftpd

Step 3: Start and Enable vsftpd Service

Once the installation is complete, start the vsftpd service and enable it to start at boot:

sudo systemctl start vsftpd
sudo systemctl enable vsftpd

Step 4: Configure Firewall

To allow FTP traffic, you need to open the FTP port (default is 21) in your firewall. Use the following commands:

sudo firewall-cmd --permanent --add-port=21/tcp
sudo firewall-cmd --reload

Step 5: Create FTP User

Create a user account for FTP access. Replace 'ftpuser' with your desired username:

sudo adduser ftpuser
sudo passwd ftpuser

Step 6: Adjust SELinux Settings

To allow FTP to write to the user's home directory, set the SELinux boolean value:

sudo setsebool -P ftp_home_dir on

Step 7: Test FTP Connection

Now, use an FTP client like FileZilla to connect to your server. Enter the server's IP address, FTP username, and password. You should be able to establish a connection.

More Examples:

Limiting FTP Access to a Specific Directory:

Edit the vsftpd configuration file:

sudo nano /etc/vsftpd/vsftpd.conf

Add or modify the following line:


Save the file and restart the vsftpd service:

sudo systemctl restart vsftpd

This restricts users to their home directory upon FTP login.

Enabling Passive Mode:

To enable passive mode, add the following lines to the vsftpd configuration file:


Save the file and restart the vsftpd service.

Related Searches and Questions asked:

  • Is Linux Mint Cinnamon Faster than Ubuntu?
  • Setting up an FTP Server on Ubuntu 22.04
  • What is the Difference Between Linux Mint and Cinnamon?
  • Is Linux Mint Cinnamon Free?
  • That's it for this topic, Hope this article is useful. Thanks for Visiting us.