Install FTP Server on Ubuntu VPS in 6 Simple Steps

This article covers the ultimate guide to help you set up the FTP server using Ubuntu VPS. We will get you through the main steps to ensure you configure all the settings correctly and see the final results. 

The guide will focus on using the vsftpd server as one of the fastest and most accurate tools for FTP installment. If you deal with UNIX-like systems, this guide will answer your questions and lead you through the step-by-step process. 

Define FTP First

FTP is a File Transfer Protocol. What does it do? It’s used for transferring files online with the help of the TCP/IP protocol. It’s a handy means of sharing files. However, it’s not only restricted to the mentioned protocol. FTP also goes hand in hand with the client framework protocol, as well as a well-known security feature – SSL/TLS – for a safe connection. 

In some cases, you can compare FTP to HTTP or SMTP. These terms stand for HyperText Transfer Protocol and Simple Mail Transfer Protocol, respectively. What is the difference? FTP takes charge of file transfer, while HTTP is responsible for web pages and SMTP for emails. 

Do you need to make any preliminary steps before we get into the guide? The main thing is to be sure the relevant VPS backs up your current OS since the guide focuses on Ubuntu 18.04. Now, without further ado, let’s get straight into the steps. 

How to Install FTP Server in 6 Easy Steps: a Full-Scale Guide Explained

If you know how to use SSH to connect to a server, you are welcome to continue reading. However, if this process raises questions in your head, it’s better to look through the basics and learn how to manage the steps beforehand. 

Get to Know vsftpd

  1. Being the first step, installing the vsftpd requires some preliminary preparation. You need to get the package updates before taking any further steps. How to manage it? Make sure to run the following command first: 
  • sudo apt-get update

When the processes reach the completion stage and the updates are finished, you will see the confirmation. 

  1. The next step will be installing the following command: 
  • sudo apt-get install vsftpd

You will see the confirmation prompt. The system will ask you to enter Y and proceed with the Enter to get the installation process rolling. 

  1. Now, you should have the installation procedure over. When it’s done, your primary task is to back up the initial file. It’s necessary to start off with an empty configuration file. The following command will be handy: 
  • sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.original

When the first steps are completed, it’s time to get into the firewall configuration process. 

Ensure FTP Traffic from the Firewall

  1. A firewall is an inevitable step if you want to make your way through the process and let the Ubuntu FTP transfer files online. But the first step is slightly different. You need to make sure the firewall is reliably enabled on your machine. It can be done with a simple command. Run it, and you will see the current status: 
  • sudo ufw status

How to assess if the firewall is on? This message “ufw: command not found” identifies the absence of the firewall within the machine framework. To change it, please enter this command: 

  • sudo apt-get install ufw
  • sudo ufw enable

It will help you enable the firewall with ease. 

  1. If you see that the firewall is enabled, you still have some tasks to manage. You need to check if traffic is allowed. To do so, make sure to type the following commands in a row:
  • sudo ufw allow OpenSSH
  • sudo ufw allow 20/tcp
  • sudo ufw allow 21/tcp
  • sudo ufw allow 990/tcp
  • sudo ufw allow 40000:50000/tcp

It will open some ports. Examples of these ports are OpenSSH, ports 20 and 21, ports 40000:50000, and port 990. 

3. Your final step is to check the status using this command - “sudo ufw status”. Make sure to carefully review and check the output. It should be depicted in the following way:

install ftp server on ubuntu vps in 6 simple steps

Build a Handy User Directory

  1. When you set up the firewall, it’s best to create a user as the next step. It will use FTP access. With the help of the “sudo adduser bluevps,” you can add a user, but make sure you change the name to fit your own needs. 
  2. Your next vital step is to enter all the details and passwords for the user. FTP should be managed by only one user directory to maintain the security protocol. The common practice is to create an FTP directory. Its writable organization will be responsible for holding the files. 
  3. Your task is to perform the commands explained in the following list one by one. 
  • sudo mkdir /home/bluevps/ftp
  • sudo chown nobody:nogroup /home/bluevps/ftp
  • sudo chmod a-w /home/bluevps/ftp
  • sudo ls -la /home/bluevps/ftp

First, you create the folder and set the ownership. Then you remove the write permission and use the last command to verify the permissions.

4. The final step will be to create a directory and set up the ownership.  

Time for vsftpd Configuration 

Now it’s time to configure vsftpd to ensure smooth FTP access. The following command set will make it possible for a user to work with a local shell to get access. Check the instructions and follow the steps below. 

  1. Begin with the “sudo nano /etc/vsftpd.conf'' command to open a configuration file and verify the content, so it fits the required system settings. In the same file, you should also enable the write to enable with the “. . . write_enable=YES . . .” command. 
  2. The next step is to uncomment chroot and change the NO value to the opposite one. 
  3. One of the following tasks is to add new values at the bottom of the document. The “user_sub_token” value is the first in the list. You will enable the user to work with the given configuration: “user_sub_token=$USER local_root=/home/$USER/ftp”.
  4. Now limit the number of ports. It will help to be sure that the amount of connections is enough: “pasv_min_port=40000 pasv_max_port=50000”.
  5. To be safe, there has to be a configuration to give access to a limited number of users, meaning only to those added to the list. It’s done by setting the userlist_deny flag to NO. Now you can save the changes. 

install ftp server on ubuntu vps in 6 simple steps

  1. One of the last steps here is to create a user list and add all the details to the file with the “echo "bluevps" | sudo tee -a /etc/vsftpd.userlist” command, and then verify active users with this code combination: “cat /etc/vsftpd.userlist”.

The final step from your side is to restart the daemon to see all the configurations working. 

Work on Security 

  1. In its default function, FTP can’t encrypt data on its own. In this case, SSL/TLS certificates come in handy. It will ensure data security. Creating the SSL certificate will be the primary step. 
  • sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem

All the necessary elements are included in the command to make it work for the next steps in the process. Then you will see the prompt to insert the personal details. There will be a corresponding field for it. 

  1. When the certificate is created, open the “sudo nano /etc/vsftpd.conf” file. The file should end with the lines starting with #rsa. Check if there are two lines with this element. 
  2. Your next task is to enable SSL and restrict access to the active SSL so that only you can manage it. Enter the following lines. They will ensure security and anonymity. 
  • ssl_enable=YES
  • allow_anon_ssl=NO
  • force_local_data_ssl=YES
  • force_local_logins_ssl=YES
  1. When it’s done, it’s time to disable the SSL reuse. The “require_ssl_reuse=NO / ssl_ciphers=HIGH” will ensure the relevant lengths of the key and prevent clients from any breakdowns. One of the final combinations is to press CTRL + X and Y plus Enter. 
  2. The final step is to restart the vsftpd to get the new configurations going with this command: “sudo systemctl restart vsftpd”.

Test Everything 

Today, you will find clients who engage with the TLS configurations mostly. This approach can help see if everything is working properly. You can personally test the connection with the help of the FileZilla FTP Client. Here’s how to do so: 

  1. You should first launch FileZilla and click on the icon bordered with red. Make sure to click the “New Site” button to enter the server details. 
  2. Now, you need to fill in the information in the given columns by using the recently created Ubuntu server info. The primary configuration focuses on the TSL, so now it’s possible to include the Use explicit FTP over TLS feature. 
  3. Proceed by clicking the “Connect” button, manage the password field, and proceed with the “OK” button. 
  4. The final step is FTP SSL certificate verification on Ubuntu VPS. When you confirm everything, you are supposed to see the test file root directory on the screen. It will be a test file. 

install ftp server on ubuntu vps in 6 simple steps

That was it! You can now transfer the files on the Internet from your source to the Ubuntu FTP server. It might seem a bit tricky, but the clear commands should help a lot with the process. 

Conclusion 

It’s easy to share files of various types from your computing sources and to the Ubuntu FTP server. It uses the SSL/STL and TCP/IP security protocols, which make this method secure and reliable. 

This tutorial covers 6 easy steps to set up the configurations and have things done.  

  1. First, you install vsftpd and back up the initial file. 
  2. Then, you ensure access to FTP connections through the firewall. 
  3. The next step was to create a user directory with relevant accesses. 
  4. Once it's done, it’s time for the vsftpd configuration. 
  5. Then, you secure the FTP server. 
  6. And the final step is to test everything on FileZilla. 

You should know more about the FTP server installation, so good luck with the process!



Blog