The FTP protocol remains one of the most popular solutions for uploading and down­load­ing files. That’s why, in this guide, we’ll show you how to set up your own Ubuntu FTP server — and highlight the key points you need to keep in mind through­out the process.

How to install an Ubuntu FTP server

Before you can start setting up your own FTP server, the first step is to choose the right software. Ubuntu systems like Ubuntu 22.04 already include a built-in option in the package manager: vsftpd. To install the ap­plic­a­tion, simply open the terminal and enter the following command:

sudo apt-get install vsftpd
bash
Image: Ubuntu 22.04: vsftpd installation in the terminal
Root or ad­min­is­trat­or priv­ileges (`sudo`) are required to install vsftpd.
Tip

Looking to store or transfer data? Lay the found­a­tion for secure file transfers and rent your secure FTP Server from IONOS — with SSH, SSL/TLS, and daily backups included.

The right hardware for your Ubuntu FTP server

The hardware re­quire­ments for an FTP server running on Ubuntu 22.04 vary depending on your use case. To ensure optimal internet con­nectiv­ity and per­form­ance, we recommend hosting your server with a pro­fes­sion­al provider like IONOS. With VPS (virtual private servers) and dedicated servers, you have two powerful options for running a high-per­form­ance FTP

The table below outlines three possible scenarios for your Ubuntu FTP server and the most suitable IONOS hosting package for each.

Ubuntu FTP Server Scenario Re­com­men­ded IONOS Package
Basic FTP server; oc­ca­sion­al data transfers VPS Linux M
Large FTP server for internal company use; regular transfers VPS Linux XL
Public FTP server; con­tinu­ous data transfers Dedicated Server AR6-32 SSD
VPS Hosting
VPS hosting at un­beat­able prices on Dell En­ter­prise Servers
  • 1 Gbit/s bandwidth & unlimited traffic
  • Minimum 99.99% uptime & ISO-certified data centres
  • 24/7 premium support with a personal con­sult­ant

How do you set up and configure an FTP server on Ubuntu? Tutorial

After finishing the short in­stall­a­tion, you can close the terminal again and start con­fig­ur­ing the Ubuntu FTP server. To do this, open the vsftpd.conf con­fig­ur­a­tion file, which is located by default in the etc directory.

Image: Snippet of available documents in the etc directory
The `etc` directory contains various con­fig­ur­a­tion and in­form­a­tion files, such as `vsftpd.conf`.

To open and edit the con­fig­ur­a­tion file of your Ubuntu FTP server, you’ll need a basic text editor. Ubuntu comes with gedit (the GNOME editor) pre­in­stalled for this purpose.

The contents of the file can generally be divided into two sections:

  • Lines that begin with a hash symbol (#) are commented out and therefore ignored by the vsftpd server. These lines may include comments ex­plain­ing various con­fig­ur­a­tion options, or they may represent disabled features.
  • Lines that do not begin with a hash symbol contain the actual con­fig­ur­a­tion settings that will be in­ter­preted and used by the server.
Image: Snippet of the vsftpd.conf file
Hash symbols are not just signals for the vsftpd server — they also improve read­ab­il­ity and help users better un­der­stand the con­fig­ur­a­tion.

There are no general re­quire­ments for ad­di­tion­al setup of the FTP server, since it depends on what you per­son­ally need and what demands you place on your server. Here it’s important that you consider the various options first. In the following sections of this Ubuntu FTP server guide, you’ll find in­form­a­tion about the various settings and their functions.

Note

To save changes to the vsftpd.conf file, you need root priv­ileges. Otherwise, you’ll only be able to view the con­fig­ur­a­tion file without making edits.

Allow anonymous access

By default, vsftpd is con­figured so that users can only log in to the FTP server with a specific account. However, the File Transfer Protocol also supports an anonymous login option that allows users to access the server without providing personal in­form­a­tion. To enable this access type, look for the entry anonymous_enable=NO in the con­fig­ur­a­tion file and change the parameter from NO to YES:

anonymous_enable=YES
txt
Image: vsftpd.conf: Anonymous FTP access configuration
Once you enter the line ‘anonymous_enable=YES’, anonymous login will be enabled on your Ubuntu FTP server.

Extend anonymous user rights

By default, access rights are heavily re­stric­ted when users log in an­onym­ously to an Ubuntu FTP server. For example, users can only download files that are readable by everyone (anon_world_readable_only=YES). If you change this setting to NO, downloads of other files will also be permitted.

Note

If your FTP server is connected to the internet, it is not re­com­men­ded to expand per­mis­sions for anonymous sessions. Otherwise, you risk un­au­thor­ised third parties misusing your server!

Ad­di­tion­al available options for expanding the per­mis­sions of anonymous users include:

  • anon_mkdir_write_enable: Allows anonymous users to create new dir­ect­or­ies if you set this to YES or remove the leading #. This requires that write_enable is also enabled.
  • anon_other_write_enable=YES: If you add this line, anonymous users will be able to rename and delete files and dir­ect­or­ies on the FTP server.
  • anon_upload_enable=YES: This enables anonymous file uploads. To use it, you must also activate write_enable and create a separate upload directory, since anonymous users cannot write directly to the home directory.

Restrict local user access to the home directory

If you want to grant local users access only to their own home directory (/home/username), you can configure this in the vsftpd.conf file. The relevant con­fig­ur­a­tion parameter is chroot_local_user. In Ubuntu 22.04, this line is commented out by default. To restrict local accounts from accessing any other dir­ect­or­ies, simply remove the # at the beginning of the line:

chroot_local_user=YES
txt

Enable or disable local user login

To allow local users to access the FTP server, the setting local_enable=YES must be enabled — which is the default con­fig­ur­a­tion. If you want to prevent local users from accessing your Ubuntu FTP server, simply comment out the cor­res­pond­ing line by adding a hash symbol (#) at the beginning:

#local_enable=YES
txt
Image: Ubuntu FTP server: Configuration of local user rights
By default, login for local user accounts is allowed in the `vsftpd.conf` file.

Enable global write access

In Ubuntu 22.04, the default con­fig­ur­a­tion does not allow either local or anonymous accounts to use FTP write commands. The relevant line for global write access, write_enable=YES, is commented out by default. To allow logged-in users to modify the file system on the vsftpd server, you’ll need to remove the leading hash symbol (#) from this line:

write_enable=YES
txt

Restrict FTP access to specific accounts

In some situ­ations, it may be useful to block certain users from accessing the Ubuntu FTP server or to clearly define which users are allowed to log in.

To deny access to specific users, add the following lines at the end of the con­fig­ur­a­tion file:

userlist_deny=YES
userlist_enable=YES
userlist_file=/etc/vsftpd.user_list
txt

Users listed in the external file vsftpd.user_list will be denied access in this setup. All other users will still be able to log in as usual.

If you want to allow access only to specific users, you need to set the userlist_deny parameter to NO. As a result, only the user accounts listed in the vsftpd.user_list file will be able to log in.

userlist_deny=NO
userlist_enable=YES
userlist_file=/etc/vsftpd.user_list
txt
Note

In both cases, you’ll need to manually create the external text file vsftpd.user_list in the /etc/ directory. Each user account should be listed on a separate line in the file.

Ad­di­tion­al options at a glance

Option Default Value De­scrip­tion
download_enable – Enable (YES) or disable (NO) downloads
ssl_enable NO Enable SSL en­cryp­tion for FTP access
force_anon_logins_ssl NO Require SSL con­nec­tions for anonymous users (YES)
force_local_logins_ssl NO Require SSL con­nec­tions for local users (YES)
anon_max_rate 0 Max download speed (in bytes/second) for anonymous users; 0 means unlimited
local_max_rate 0 Max download speed (in bytes/second) for local users; 0 means unlimited
max_clients 0 Max number of clients allowed at the same time; 0 means no limit
max_per_ip 0 Max number of con­nec­tions allowed per IP address; 0 means no limit
anon_root /home/ftp Default directory for anonymous users

By the way, you can view a complete list of all available options by running the following command in the terminal:

man vsftpd.conf
bash
Image: Manual page of the vsftpd configuration file
In the manual of the Ubuntu FTP server ap­plic­a­tion, you can find detailed de­scrip­tions of all available options.
Dedicated Server
Per­form­ance through in­nov­a­tion
  • En­ter­prise hardware
  • Con­fig­ur­able hardware equipment
  • ISO-certified data centres

How to use the FTP server under Ubuntu 22.04

After you’ve set the con­fig­ur­a­tion file to your desired spe­cific­a­tions, don’t forget to save it. For the server ap­plic­a­tion to accept all changes, a restart is required, which you initiate with the following command:

sudo systemctl restart vsftpd
bash

If you haven’t started the FTP server yet, do this with the terminal command:

sudo systemctl start vsftpd
bash
Tip

If you want to stop the Ubuntu FTP server, simply replace the start parameter in the previous command with stop.

Create an FTP user account

Now that you’ve set up and started your Ubuntu FTP server, you’ll need a user account to log in. In this example, we’ll create a user named ‘ftpuser’ with the password ‘test123’.

sudo useradd -m user -s/usr/sbin/nologin
sudo passwd user
bash

Next, allow login access for the NoLogin shell by adding the following line to the end of the /etc/shells file:

/usr/sbin/nologin
txt

Connect to the FTP server

You can now use the user account you created to connect to the vsftpd server using the FTP client of your choice. A popular solution, which is included in Ubuntu’s default package re­pos­it­or­ies, is the cross-platform open-source ap­plic­a­tion FileZilla. You can install it the tra­di­tion­al way via the terminal:

sudo apt-get install filezilla
bash

Open FileZilla and add a new con­nec­tion using the ap­pro­pri­ate details: In the Host field, enter the IP address of your Ubuntu FTP server — unless you’ve changed the default settings, it will be listening on port 21. Select the ‘File Transfer Protocol’, and if possible, choose ‘SFTP (Secure FTP)’ or ‘FTP over TLS’, as a plain FTP con­nec­tion over port 21 poses a sig­ni­fic­ant security risk. For the Logon Type, select ‘Normal’. Enter the pre­vi­ously created username and password in the User and Password fields. Click ‘Connect’ to establish the con­nec­tion to your server.

Image: FileZilla Site Manager
The FileZilla client offers detailed con­fig­ur­a­tion options for con­nect­ing to an FTP server.

500 OOPS: Security feature causing issues

If you’ve set up an Ubuntu FTP server and certain settings aren’t working, there could be several reasons: You may have forgotten to restart the FTP server or save the con­fig­ur­a­tion file, or there may be a syntax error in the vsftpd.conf — for example, a misplaced space character. One common error message with a com­pletely different root cause is the following:

500 OOPS: vsftpd: refusing to run with writable root inside chroot ()

This message, which may appear during con­nec­tion attempts, is not actually an error in the tra­di­tion­al sense — it’s a security feature. The back­ground is a potential vul­ner­ab­il­ity in the glibc library (Ubuntu’s default C pro­gram­ming language library), which users with write access to their own root directory could exploit. To bypass this security re­stric­tion, there are two possible solutions:

  1. Remove write per­mis­sions from the user’s root directory: This method revokes write access to the user’s own root directory, limiting write op­er­a­tions to sub­dir­ect­or­ies only. This re­stric­tion resolves the ‘500 OOPS’ issue, but it can be in­con­veni­ent if files are required to be written directly to the root directory. Use the following terminal command to apply this fix:
chmod a-w */home/user*
bash
  1. Allow write per­mis­sions to the root directory in vsftpd.conf: If you have no security concerns about potential misuse of write access, you can ex­pli­citly allow this behaviour by con­fig­ur­ing the Ubuntu FTP server ac­cord­ingly. To do this, simply add the following line to the con­fig­ur­a­tion file:
allow_writeable_chroot=YES
txt
Free VPS Trial
Try a virtual server risk-free for 30 days

Try out your VPS for 30 days. If you're not satisfied, we'll fully reimburse you.

Go to Main Menu