Mar 02, 2026
Domantas G.
7min Read
File Transfer Protocol (FTP) is a method for sharing files between computers over the internet using the TCP/IP protocol. It incorporates a client-server framework and Secure Sockets Layer (SSL) to ensure secure data transfer.
FTP is similar to the Hypertext Transfer Protocol (HTTP) and Simple Mail Transfer Protocol (SMTP) but handles a different data type. It is essential for managing remote systems like a virtual private server (VPS).
In this article, we will explain how to set up an FTP server on an Ubuntu VPS. We’ll be using a vsftpd server, one of the fastest and most secure FTP servers for UNIX-like systems.
Before getting into the steps, purchase an Ubuntu VPS hosting plan with extensive software support, like Hostinger’s, to avoid incompatibility issues. For this tutorial, your server must be running Ubuntu as the commands may differ depending on the Linux distribution you’re using.
Connect to your server using an SSH client like PuTTY, Terminal, or Hostinger’s browser terminal. Hostinger users can find the IP address and login details in hPanel’s VPS overview menu.
By default, you will connect as root. We recommend creating a new account with superuser privileges to avoid accidental destructive command execution. Here are the commands:
adduser account
usermod -aG sudo account
Replace account with your desired username. Then, switch to the new user by running the following command and proceed with the setup:
su account
cd

In this section, we’ll describe six steps to set up an FTP server on Ubuntu. If you encounter difficulties along the way, use Kodee, our VPS AI assistant, to help troubleshoot any issues.
Begin by installing vsftpd, which is responsible for enabling the FTP service on your VPS. Here are the steps:
sudo apt-get update
sudo apt-get install vsftpd
sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.original
After installing, configure your system’s firewall rules to allow the Ubuntu FTP server to communicate via the internet. You can do so using the Ubuntu Uncomplicated Firewall (UFW). Here are the steps:
sudo ufw status
sudo apt-get install ufw
sudo ufw enable
sudo ufw status
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
sudo ufw status
Check the Terminal output to ensure you have these ports open for the FTP server to work properly:
Aside from UFW, Hostinger VPS users can ask Kodee to set up a new firewall rule on their server. For example, you can ask it, “Open port 20, 21, 22, 990, and 40000:50000 TCP on my server to any IP address.”
After enabling communication for the protocol, create a new user that will use the FTP access. To do so, run the following:
sudo adduser hostinger
Replace the placeholder with your desired name. Then, enter a user password and fill in all the required details.
When configuring FTP, you should ideally restrict its access to one specific directory for security purposes. For this reason, vsftpd uses chroot jails to limit a local user to only their home directory by default.
However, vsftpd security might prevent non-FTP users from writing on their home directories. To solve this issue, create an FTP directory that acts as chroot, containing a writable folder for the transferred files. Here are the steps:
sudo mkdir /home/hostinger/ftp
sudo chown nobody:nogroup /home/hostinger/ftp
sudo chmod a-w /home/hostinger/ftp
sudo ls -la /home/hostinger/ftp
total 8
dr-xr-xr-x 2 nobody nogroup 4096 Oct 8 11:32 .
drwxr-xr-x 3 hostinger hostinger 4096 Oct 8 11:32 ..
Hostinger VPS users can also use Kodee to list all files, including hidden ones, along with their permissions in a specific directory. All you need to do is ask something like “Can you list all files, including hidden ones, in /home/hostinger/ftp along with their permissions?”
sudo mkdir /home/hostinger/ftp/files
sudo chown hostinger:hostinger /home/hostinger/ftp/files
echo "vsftpd sample file" | sudo tee /home/hostinger/ftp/files/sample.txt
Next, configure vsftpd and the FTP access. In this example, we will allow a single user to connect using a local shell account. The two key configurations required for this are already set in the vsftpd.conf configuration file. Here are the steps:
sudo nano /etc/vsftpd.conf
# Allow anonymous FTP? (Disabled by default). anonymous_enable=NO # # Uncomment this to allow local users to log in. local_enable=YES
write_enable=YES
chroot_local_user=YES
user_sub_token=$USER local_root=/home/$USER/ftp
pasv_min_port=40000 pasv_max_port=50000
userlist_enable=YES userlist_file=/etc/vsftpd.userlist userlist_deny=NO
echo "hostinger" | sudo tee -a /etc/vsftpd.userlist
cat /etc/vsftpd.userlist
sudo systemctl restart vsftpd
Since FTP doesn’t encrypt data by default, install an SSL/TLS certificate to secure the file transfer. Here are the steps:
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem
sudo nano /etc/vsftpd.conf
# rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem # rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
rsa_cert_file=/etc/ssl/private/vsftpd.pem rsa_private_key_file=/etc/ssl/private/vsftpd.pem
ssl_enable=YES
allow_anon_ssl=NO force_local_data_ssl=YES force_local_logins_ssl=YES
ssl_tlsv1=YES ssl_sslv2=NO ssl_sslv3=NO
require_ssl_reuse=NO ssl_ciphers=HIGH
sudo systemctl restart vsftpd
Great work! You have now configured the FTP server on your Ubuntu VPS to work over the SSL/TLS protocol.
The last step is to test whether your Ubuntu FTP server is working properly and securely. You can do so using an FTP client with encryption support. In this tutorial, we will use FileZilla.
After you download and install the FileZilla FTP client in your local system, follow these steps:
That’s all! Now, you can perform various file transfers from your computer to the Ubuntu FTP server and vice versa.
Setting up an Ubuntu FTP server simplifies file transfer between your remote server and local computer, improving development efficiency. In addition, it enhances security and ensures reliable connection by utilizing the SSL/TLS and TCP/IP protocols.
In this tutorial, we have explored how to set up an FTP server on an Ubuntu VPS using vsftpd in six steps. Here is a recap:
Before setting up the FTP, remember to connect to your VPS via SSH and create a new superuser account. If you encounter difficulties during the process, use Kodee to help troubleshoot the issue quickly.