How to Setup an FTP Server with ProFTPd on CentOS 7

29/12/2020
Chưa phân loại
FTP (File Transfer Protocol) is a very popular protocol for file sharing. There are many popular FTP servers out there. ProFTPd is one of them. ProFTPd is a very powerful and easy to configure FTP server software.

In this article, I am going to show you how to install and configure ProFTPd FTP server on CentOS 7. So, let’s get started.

Installing ProFTPd Server:

ProFTPd is available in the EPEL package repository which is not enabled by default. Once you enable EPEL package repository, you can easily install ProFTPd using the YUM package manager.

First, update the YUM package repository cache with the following command:

$ sudo yum makecache

Now, enable the EPEL repository with the following command:

$ sudo yum install epel-release

Now, press y and then press <Enter> to continue.

YUM may ask you to accept the GPG key of the CentOS repository. To do that, press y and then press <Enter>.

EPEL repository should be enabled.

Now, update the YUM package repository cache again with the following command:

$ sudo yum makecache

Now, install ProFTPd with the following command:

$ sudo yum install proftpd proftpd-utils

Now, press y and press <Enter> to confirm.

YUM may ask you to accept the GPG key of the EPEL repository. Just, press y and then press <Enter> to accept it.

ProFTPd should be installed.

Now, check whether the proftpd service is running with the following command:

$ sudo systemctl status proftpd

As you can see, the proftpd service is not active. So, it’s not running.

To start the proftpd service, run the following command:

$ sudo systemctl start proftpd

As you can, see proftpd service is now running.

$ sudo systemctl status proftpd

Now, open FTP ports in firewalld firewall with the following command:

$ sudo firewall-cmd –zone=public –add-service=ftp –permanent

Now, reload firewalld with the following command for the changes to take effect.

$ sudo firewall-cmd –reload

Accessing The FTP Server:

Now, to test whether the FTP server is working, let’s try to connect to it from an FTP client program such as FileZilla.

First, you have to know the IP address of the FTP server. For that, run the following command on the FTP server.

$ ip a

As you can see, the IP address of my FTP server is 192.168.21.133. It will be different for you. So, make sure to replace it with yours from now on.

Now, open FileZilla or your preferred FTP client and type in the IP address of your FTP server, your login username and password and the port 21. Once you’re done, click on Connect (Quickconnect in FileZilla). You should be connected to the FTP server as you can see in the screenshot below.

Automatically Start ProFTPd on System Boot:

Now that ProFTPd FTP server is working just fine, it’s a good idea to add the proftpd service to the system startup so that it will start automatically on system boot.

To add the proftpd service to the system startup, run the following command:

$ sudo systemctl enable proftpd

As you can see, the proftpd service is added to the system startup.

Configuration Files of ProFTPd:

On CentOS 7, the default configuration file of ProFTPd is /etc/proftpd.conf.

The configuration file is well documented. So, you can just use it as a manual as well.

As it contains a lot of comments, it’s hard to see which lines are active and which are not (commented out). So, It’s best to make a backup copy of the original configuration file and remove the comments from the original configuration file. So, whenever you need any help, you can always look at the backup copy.

To make a backup of the /etc/proftpd.conf file, run the following command:

$ sudo cp -v /etc/proftpd.conf /etc/proftpd.conf.backup

Now, remove all the comments from the original configuration file /etc/proftpd.conf with the following command:

$ sudo egrep -v ‘^.*#’ /etc/proftpd.conf | sudo tee /etc/proftpd.conf

This is the original configuration file before all the comments were removed.

This is the original configuration file after all the comments are removed. Looks neat!

Add New Users:

The default configuration of CentOS lets the local system login users to log into the FTP server and upload files to their home directories. So, in order to add a new FTP user, all you have to do is to create a new user on the CentOS 7 server where ProFTPd is installed.

To add a new user linda (let’s say), run the following command:

$ sudo adduser -m linda

Now, set a password for the newly created user linda with the following command:

$ sudo passwd linda

Now, re-type the password and press <Enter>.

The password should be set.

As you can see, the user linda can connect to the FTP server. No extra configuration required.

Chroot Users into Their Home Directories:

By default, the FTP users can navigate to the root directory as well. Even though they can’t make any changes to files and directories they don’t have permissions to. But, it’s still a bad idea to let them explore the root directory freely.

To lock users to their own home directory, you can simple enable Chroot jail feature of ProFTPd. By default, the CentOS 7 version of ProFTPd has Chroot jail enabled. But, if it is not enabled for you in some case, you can enable it as follows.

To enable chroot jail, first, open the ProFTPd configuration file /etc/proftpd.conf with the following command:

$ sudo vim /etc/proftpd.conf

Now, type in the line as marked in the screenshot below and save the file.

Now, restart the proftpd service with the following command:

$ sudo systemctl restart proftpd

Now, the FTP users will only be able to explore their own home directories

So, that’s how you install and configure ProFTPd FTP server on CentOS 7. Thanks for reading this article.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

How to crop in GIMP

What does GIMP do? One of the most important jobs you can do in GIMP, is cropping the parts you want. Perhaps you want...
29/12/2020

Best Ubuntu VPN

Linux has always been the go-to choice for all privacy-minded individuals. Its open source nature provides a guarantee...
29/12/2020

PHP and MySQL/MariaDB tutorial on Ubuntu

PHP and MySQL are the two most important tools to learn today for web programming. PHP is a server side programming language...
28/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Tìm Hiểu Về Thuê Proxy US – Lợi Ích và Cách Sử Dụng Hiệu Quả
11/12/2024

Mua Proxy V6 Nuôi Facebook Spam Hiệu Quả Tại Onetcomvn
03/06/2024

Hướng dẫn cách sử dụng ProxyDroid để duyệt web ẩn danh
03/06/2024

Mua proxy Onet uy tín tại Onet.com.vn
03/06/2024

Thuê mua IPv4 giá rẻ, tốc độ nhanh, uy tín #1
28/05/2024