How to install an FTP Server on Linux VPS Server

Where necessary, you may need to have access to a VPS server so you can follow how to implement the steps in this article.  You can get a cheaper VPS Server from Contabo with 4vCPU cores, 8GM RAM, and 32TB Bandwidth for less than $5.50 per month. Get this deal here now

Table of Contents

Cloud VPS S

$5.50 Monthly
  • 4 vCPU Cores | 8GB RAM


$15.50 Monthly
  • 6 vCPU Cores | 16GB RAM


$17.50 Monthly
  • 8 vCPU Cores | 24GB RAM

FTP stands for File Transfer Protocol. And it’s a TCP protocol used to transfer files to and from a remote server. You can use FTP to retrieve files from your remote server to your local computer and vice versa.

Establishing an FTP connection

To establish an FTP connection, you will need an FTP server installed on your remote Linux VPS or Cloud server. And then you will have to install an FTP client on your local computer to make the connection. 

Now there is a difference between an FTP server and an FTP client. Let me explain further below;

What is an FTP server?

An FTP server is a script that is installed on a remote server to wait for incoming file transfer requests from the client side. The script is configured to take use of the FTP protocol to accept connections from remote clients that seek to transfer files to and from a remote server.

Without an FTP server configured on a remote machine, it’s impossible to do file transfer using FTP. And so, it’s important that a suitable FTP server script is installed and configured to achieve what you want.

There are a ton of FTP server scripts out there, but the most widely used is vsftpd. This is an open-source FTP server script that’s easy to configure on the most popular Linux distros like Ubuntu. It’s pretty straightforward even for beginners in the Linux community.

What is an FTP client?

In order to connect to an FTP server so you can transfer files to and from the server remotely, you will need to have an FTP client installed on your local computer. An FTP client is software that allows you to establish a connection with the remote FTP server so you can transfer files bidirectionally (to and from).

There are a ton of free FTP clients out there, and you can use whatever you like. Probably the most widely used are; Winscp and FileZilla but there are several others with simplicity and good features you can make use of.

How to connect to an FTP server

You will need to have an FTP user account to establish a remote FTP connection to the FTP server. An FTP account is created an configured on the remote server on which FTP is running. 

The most suitable FTP user account should have a special directory that could be accessed by default when the connection is successfully established.

The other important aspect of FTP user accounts is setting the necessary file and directory permissions. A system administrator with root or sudo privileges can decide to define which permissions can a certain FTP user get when accessing their accounts. Users could be assigned read, write, and where necessary execute permissions on their accounts, or they could be restricted to execute certain file tasks when logged in.

FTP login information

On your local computer, you will need to have FTP account login details to establish a successful connection to the remote FTP server. These details include;

FTP server Hostname or Public IP address

Your FTP server hostname could be a public IP address of your remote server on which FTP is configured, or a custom domain URL configured to accept FTP connections on the server.

In most cases, you may just need the Public IP address of your server and you will be good to go.

Username & Password

When your FTP account is created, it’s assigned to a user with a username and a password. Root users or Sudo users may have administrative privileges to create FTP users by assigning them usernames and passwords.

FTP connections through the Firewall

Just like any other server that accepts remote incoming traffic, the firewall has to be configured to allow the FTP server to establish inbound connections from remote clients. 

By default, FTP uses TCP ports; 20 & 21. Port 20 is for the data channel and 21 is for the control channel.

So, what does this mean?

An active FTP session relies on a control channel also known as the command channel to transmit command requests and responses to the server so the connection is established. On the other hand, a data channel is established to allow the transfer of data. 

Unless if your FTP server is configured in a different or custom way, port 21 is by default used for the control channel and port 20 is for the data channel.

FTP server installation Steps 

Now, installing FTP on Ubuntu Linux takes the following steps;

Update your server first

It’s a common habit in the Linux community to first update the system before installing any script. And we can achieve this by using the following command;

sudo apt update

Install vsftpd server script

In this article, we’re choosing vsftpd FTP server script as it’s easier to set up and widely used throughout the Linux community. To install the script, we will use the following command;

sudo apt install vsftpd

If vsftpd is successfully installed, it will automatically run on the machine and you can verify the status by using the following command;

systemctl status vsftpd

The above command should tell you if your FTP server is now running or it’s not. If it’s not running, you will have to start it by running the following command;

sudo service vsftpd start

Create an FTP account

As I said earlier in this article, only root or specified sudoers can create or add users to the system. And so, if you fit in this category, we can now create an FTP user named ugacomp or named anything you want by running the following command;

sudo useradd ugacomp

Make sure you replace ugacomp with your own preferred username for your FTP user account.

Now, we also need to add a password to our user by running the following command;

sudo passwd ugacomp

Again, you have to replace ugacomp with your choice username. 

Please note that when you’re typing in the password, you’re most likely not to see anything on the terminal. So, the best way is to first write your password somewhere on your computer and then type it on the terminal as prompted by the passwd command.

Create an FTP directory for the User

We need to assign our FTP user a directory that they will access when they’re logged in. For my case, this directory will also be named ugacomp. But you can name it anything you want. And we will use the following command to achieve this;

sudo mkhomedir_helper ugacomp

If you’re a root user, directory ugacomp or anything you’ve named it is most likely to be created inside your root home directory. So, you can verify this by going to that root home directory using the cd .. command and use dir command to see what is inside. 

For example, you can go to your root home directory by running the following command;

cd ..

Please note that the above command is interpreted as cd Space Double dots

And then you can see whether your FTP user home directory is listed as a subdirectory here by running the following command;


Add write & read permissions to the FTP directory

We have to make sure the created directory has all the necessary permissions that can allow the FTP user to write and read files. My directory is named ugacomp and I will use the following command to assign permissions;

sudo chmod -R 775 ugacomp

Add FTP user to the Sudoer group

You can optionally add our FTP user to the Sudoer group to have some administrative privileges to the system where necessary. Remember, the FTP user I created is also named ugacomp and I will use the following command to add it to the sudoers group

sudo usermod -aG sudo ugacomp

Configure Firewall to allow FTP connections

We need to open FTP ports 20 & 21 to ensure that the FTP connection passes through on the server without limitations.

Now, configuring a firewall for your Linux server will depend on the VPS platform you’re using. 

For example, if you’re using AWS, Azure, DigitalOcean, and the alike, you will need to configure the security & firewall settings of your server using your account console Interface.

On the other hand, if your VPS server provider doesn’t offer this functionality in the user console, you will have to install your own firewall management system on the server.

In this article, we will install and use iptables as our choice firewall management platform on the server. And we can achieve this by running the following installation command;

sudo apt-get install iptables

The above command installs iptables firewall on our Linux server. But we have to confirm if iptables is actually running on the system by using the following command;

systemctl status iptables

Allow TCP ports 20 & 21 through iptables firewall;

Before we even allow the FTP ports, the first thing we have to urgently do is to open SSH port 22. This is because when you install a firewall system on your server, SSH is important to remotely access the server terminal. And if you don’t quickly open port 22, you’re likely to lose access to the terminal as you will be locked out when an SSH session abruptly times out. By default, the firewall will close all the ports that are not enabled on the system. 

So, let’s open SSH port 22 using the following command;

sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT

Finally, we can open FTP ports; 20 & 21 using iptables by running the following commands;

sudo iptables -A INPUT -p tcp --dport 20:21 -j ACCEPT

RECOMMENDED READING: How to Install OpenVPN Server on Ubuntu 

Download the FTP client on your local computer 

You can download an FTP client of your choice and use the login details to connect to your FTP server.

I would recommend winSCP or FileZilla FTP clients.

While setting up your FTP client on local computer, make sure you do the following;

  • You should select FTP as the File Protocol. There is a difference between FTP & SFTP. You’re most likely to use FTP as your server may not be configured to use secure SFTP.
  • Use the public IP address of your VPS server as the FTP hostname in the client.

  • Fill in the username and password we created for FTP. You should have these details saved somewhere on your local computer. 

If you liked this article, you can share it on Social Media or even link to it as an act of endorsement. Thank you so much.

That’s all and happy file transfer to and from your remote FTP server

Hire us to handle what you want

Hire us through our Fiverr Profile and leave all the complicated & technical stuff to us. Here are some of the things we can do for you:

  • Website migration, troubleshooting, and maintenance.
  • Server & application deployment, scaling, troubleshooting, and maintenance
  • Deployment of Kubernetes, Docker, Cloudron, Ant Media, Apache, Nginx,  OpenVPN, cPanel, WHMCS, WordPress, and more
  • Everything you need on AWS, IBM Cloud, GCP, Azure, Oracle Cloud, Alibaba Cloud, Linode, Contabo, DigitalOcean, Ionos, Vultr, GoDaddy, HostGator, Namecheap, DreamHost, and more.

We will design, configure, deploy, or troubleshoot anything you want. Starting from $10, we will get your job done in the shortest time possible. Your payment is safe with Fiverr as we will only be paid once your project is completed.