loading...

CentOS 7 – Setting up an FTP server

How to configure WordPress multisite with NGINX

As we know, multiple clients need a file exchange, and one of the common services that allows an easy and fast file exchange is the FTP technologies. In this section, we will talk about how to set up an FTP server to help transfer data between two machines in the same network or from different networks.

First, we need to install an FTP server using the default package manager:


$ sudo yum install vsftpd ftp

After having the server installed, we can start the configuration by editing the VSFTPD configuration file:


$ sudo nano /etc/vsftpd/vsftpd.conf

We need to find the following lines and change them as shown:


anonymous_enable=NO  # Disable anonymous login
ftpd_banner=Welcome to The Packt FTP Service.  # Banner message
use_localtime=YES  # Make the server use the local machine time
local_enable=YES  # Allow local users to login
write_enable=YES  # Allow Local users to write to directory

Then we should restart the service and add it to the system startup to auto-start at the next boot:


$ sudo systemctl enable vsftpd
$ sudo systemctl start vsftpd

Note

Basically, most of the errors that won’t let the service start are related to typos in the configuration file. If we ever get any, we should first check that file for any miswritten options.

After that, to make sure that the service is accessible from other machines other than the machine itself, we need to open the FTP port in the firewall:


$ sudo firewall-cmd --permanent --add-port=21/tcp
$ sudo firewall-cmd --permanent --add-port=20/tcp
$ sudo firewall-cmd --permanent --add-service=ftp
$ sudo firewall-cmd --reload

Then update the SELinux Boolean values for FTP service:


$ sudo setsebool -P ftp_home_dir on

And, finally, we should make some FTP users so clients can use them to log in:


$ sudo useradd packt
$ sudo passwd packt

Now we can start testing the service by going to one of the clients either on the same network or outside, and do as follows:


$ ftp Server_IP_Address

Or:


$ ftp domain_name

And then we type in the user and its password which we have already defined. If we get access to the FTP service that means that our FTP server is successfully set up.

Comments are closed.

loading...