install ftp server ubuntu

Install FTP Server Ubuntu: Step-by-Step Guide

By Mark Martin
AD

Setting up an FTP server on Ubuntu provides a reliable method for transferring files across a network, whether for personal use or professional web management. This guide walks through the installation, configuration, and securing of a robust FTP service on an Ubuntu server.

Choosing the Right FTP Server Software

Before diving into installation, selecting the appropriate software is crucial. vsftpd (Very Secure FTP Daemon) stands out as the preferred choice for most Ubuntu users due to its strong security record, performance, and straightforward configuration. Other options like ProFTPD and Pure-FTPd exist, but vsftpd offers the best balance of features and safety for typical use cases.

Installing vsftpd on Ubuntu

The installation process is streamlined thanks to Ubuntu's Advanced Package Tool (APT). You will update your package list and then install the software with just two commands. This ensures you get the latest stable version directly from the repository.

AD
Installing an FTP Server on Ubuntu
Installing an FTP Server on Ubuntu
How to Install an FTP Server on Ubuntu in 5 Steps
How to Install an FTP Server on Ubuntu in 5 Steps
How To Install GFTP Free Multithreaded FTP Client In Ubuntu Linux
How To Install GFTP Free Multithreaded FTP Client In Ubuntu Linux

Step-by-Step Installation Commands

  • Update your local package index with: sudo apt update
  • Install the vsftpd package with: sudo apt install vsftpd

Once the installation completes, the vsftpd service will start automatically. You can verify its status immediately by running sudo systemctl status vsftpd to ensure it is active and running.

Configuring Firewall Rules

Ubuntu typically comes with UFW (Uncomplicated Firewall) enabled, which blocks incoming connections by default. To allow FTP traffic, you must explicitly open the necessary ports. This step is often where new administrators encounter connection issues, so it requires careful attention.

How to Install and Configure Pure-FTPd Server on Ubuntu 22.04
How to Install and Configure Pure-FTPd Server on Ubuntu 22.04
Setting up an FTP Server on Ubuntu 22.04
Setting up an FTP Server on Ubuntu 22.04
How to Install FFmpeg on Ubuntu (Step-by-Step CLI Guide) in 2026
How to Install FFmpeg on Ubuntu (Step-by-Step CLI Guide) in 2026

Allowing FTP Ports

  • Allow SSH to prevent losing remote access: sudo ufw allow OpenSSH
  • Allow FTP port 21: sudo ufw allow 21/tcp
  • For passive mode (highly recommended): sudo ufw allow 30000:31000/tcp

After configuring these rules, enable the firewall with sudo ufw enable if it isn't already active. Passive mode requires a specific range of ports to be open, which we will define later in the configuration file.

Configuring vsftpd for Secure Operation

The main configuration file is located at /etc/vsftpd.conf. This is where you adjust security settings, user access, and network behavior. It is recommended to create a backup of the original file before making changes, allowing you to revert if needed.

AD

Essential Security Settings

Open the configuration file with a text editor like Nano: sudo nano /etc/vsftpd.conf. You will need to modify or add the following directives to lock down your server:

Installing and Configuring an FTP Server in Ubuntu
Installing and Configuring an FTP Server in Ubuntu
How to Install and Configure FTP Server in Ubuntu
How to Install and Configure FTP Server in Ubuntu
How to setup FTP server on ubuntu 14.04 ( VSFTPD )
How to setup FTP server on ubuntu 14.04 ( VSFTPD )
Setting up WebDAV on Ubuntu
Setting up WebDAV on Ubuntu
Learn how to setup and install qBittorrent on Ubuntu
Learn how to setup and install qBittorrent on Ubuntu
How to Install and Configure Serv-U FTP Server on Ubuntu 22.04
How to Install and Configure Serv-U FTP Server on Ubuntu 22.04
Setting Recommended Value Description
anonymous_enable NO Disables login for anonymous users, improving security.
local_enable YES Permits local system users to log in.
write_enable YES Allows changes to the filesystem, such as upload and delete.
chroot_local_user YES Jails users in their home directories, preventing directory traversal.

Setting Up Passive Mode

Active mode FTP can complicate connections through firewalls and NAT routers. Passive mode solves this by having the client connect to both the server and a designated port range. To configure this, append the following lines to your vsftpd.conf file.

Passive Mode Configuration

Add these directives to the bottom of your configuration file:

AD
  • pasv_enable=YES
  • pasv_min_port=30000
  • pasv_max_port=31000

After saving the file, restart the vsftpd service with sudo systemctl restart vsftpd to apply the new network settings.

How to configure vsftpd on Ubuntu?
How to configure vsftpd on Ubuntu?
How to Install an FTP Server on Ubuntu in 5 Steps
How to Install an FTP Server on Ubuntu in 5 Steps
How to Install an FTP Server on Ubuntu in 5 Steps
How to Install an FTP Server on Ubuntu in 5 Steps
Setting up an SFTP Server on Ubuntu
Setting up an SFTP Server on Ubuntu
Setting up VSFTPD Server on Ubuntu 22.04
Setting up VSFTPD Server on Ubuntu 22.04
How to Install LEMP Server In Ubuntu Precise 12.04
How to Install LEMP Server In Ubuntu Precise 12.04
Getting Started With Ubuntu Server: A Step-by-Step Guide
Getting Started With Ubuntu Server: A Step-by-Step Guide
Installing Ubuntu Server 9.04 - gHacks Tech News
Installing Ubuntu Server 9.04 - gHacks Tech News
Setting up Ubuntu as an NTP Server using Chrony
Setting up Ubuntu as an NTP Server using Chrony
How to install Portainer on Ubuntu
How to install Portainer on Ubuntu
Installing the Plex Media Server on Ubuntu
Installing the Plex Media Server on Ubuntu
Patrick Fromaget – Page 32
Patrick Fromaget – Page 32
5 Useful PPAs for Ubuntu - Make Tech Easier
5 Useful PPAs for Ubuntu - Make Tech Easier
How to Install Firefox on Ubuntu (2026 Guide)
How to Install Firefox on Ubuntu (2026 Guide)

Creating Restricted FTP Users

For enhanced security, it is best to create dedicated FTP users rather than allowing SSH access for web administrators. You can create a user who is restricted to the FTP service only, ensuring they cannot access the shell environment.

User Management Steps

  1. Create a new user without SSH access: sudo adduser ftpuser
  2. Add the user to the allowed FTP list: echo "ftpuser" | sudo tee -a /etc/vsftpd.chroot_list
  3. Set a password for the user: sudo passwd ftpuser

To restrict the user to local files only, add the following line to the config file: userlist_file=/etc/vsftpd.chroot_list and ensure userlist_enable=YES is set. This ensures only users on the list can log in.

AD

Securing the Connection with SSL/TLS

Transmitting passwords and data in plaintext is a significant security risk. Enabling SSL/TLS encrypts the connection, protecting credentials and content from eavesdropping. You will need to generate a self-signed certificate for this purpose.

Generating SSL Certificates

Create a directory for the certificate and generate it using OpenSSL:

  • sudo mkdir -p /etc/ssl/private
  • sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem

Configure vsftpd to use the certificate by adding these lines to /etc/vsftpd.conf:

  • ssl_enable=YES
  • allow_anon_ssl=NO
  • force_local_data_ssl=YES
  • force_local_logins_ssl=YES
  • rsa_cert_file=/etc/ssl/private/vsftpd.pem
  • rsa_private_key_file=/etc/ssl/private/vsftpd.pem

Restart the service with sudo systemctl restart vsftpd. Your server is now ready to accept secure FTP connections.

AD