If you're setting up a Linux server, you'll need FTP access. This means first installing an FTP server on Linux. It should be one of the first things you do after installing your server operating system.

Many Linux servers run Ubuntu. So, let's look at how to setup an FTP server on Ubuntu server.

What Is an FTP Server?

FTP, or File Transfer Protocol, is the system used to upload (put) to or download (get) files from a server. You've probably used it without realizing in the past, when grabbing files or uploading images to the web. Or you might have used an FTP client to directly connect to the FTP file server.

For this to happen, FTP server software must be installed on the remote server hosting the files.

Whether you're building a Linux home server, a web server, game server, or whatever server suits your project, FTP is the simplest way to transfer data from one system to another.

Install a Server on Ubuntu

Installing an FTP server on Ubuntu is straightforward. Arguably the best solution is vsftpd. Follow the steps below to install and configure an FTP server on Ubuntu with vsftpd.

1. Install vsftpd

You might already have vsftpd installed. To check, open a terminal window and input

        sudo apt list --installed
    

You should find vsftpd near the bottom of the list. If not, simply install with

        sudo apt install vsftpd
    

Once installed, it's time to configure vsftpd. Start by making a copy of the original config file. This means if anything goes wrong, the default config can be restored.

        sudo cp /etc/vsftpd.conf /etc/vsftpd.conf_default
    

With that done, launch the service with:

        sudo systemctl start vsftpd
    

Confirm the server is running with:

        sudo systemctl enable vsftpd
    

With vsftpd installed you can begin configuration.

2. Create an FTP User

The first thing you need is an FTP user account. With this you can use any FTP client to access the files hosted on the server via vsftpd. In the terminal, input:

        sudo useradd –m username
    

(Substitute "username" with your intended username.)

        sudo password username
    

With the username and password set, create a test file in the account's home folder to confirm it works:

        cd /home/username

sudo nano testfile.txt

When you first connect to your Ubuntu FTP server, you should see testfile.txt.

3. Secure Your Ubuntu FTP Server

Before setting up a connection, however, you'll need to ensure FTP ports are open in Ubuntu. By default, these are closed for security reasons in ufw (Uncomplicated Firewall).

To enable access via port 20, use

        sudo ufw allow 20/tcp

If your distro uses a different firewall or you've installed an alternative, check the documentation to open the ports.

You'll also want users to be able to upload files. You can set this in the config file. Open it to edit:

        sudo nano /etc/vsftpd.conf
    

Find write_enabled and uncomment the entry, ensuring it is set to "YES":

        write_enable=YES
    

Hit Ctrl+X to exit, and Y to save.

For publicly-accessible FTP servers you'll want to limit what access each user has. With chroot we can restrict each user to its home directory. In vsftpd.conf, find and uncomment this line (remove the #):

        chroot_local_user=YES
    

Again, Ctrl+X to exit, and Y to save.

For multiple users, maintaining a list is a smarter option.

First, open vsftpd.chroot_list in your text editor.

        sudo nano /etc/ vsftpd.chroot_list
    

Here, list the usernames you wish to limit to their own folders. Save and exit, then return to vsftpd.conf and ensure chroot_local_user=YES is uncommented:

        #chroot_local_user=YES
    

Instead, uncomment

        chroot_list_enable=YES
    

and

        chroot_list_file=/etc/vsftpd.chroot_list
    

It should look like this:

Configure an FTP server in Ubuntu

Again, save and exit. Finally, restart the FTP service:

        sudo systemctl restart vsftpd.service
    

Finally, use the hostname command to check the name of your Ubuntu server. You can then use this to connect to the FTP server. If you prefer to use the IP address, input the ip address command and make a note of it.

4. Encrypted Connections: FTP+SSL=FTPS

You can also force encryption of traffic to and from your Ubuntu FTP server using SSL/TLS.

Related: Encryption terms everyone should know

In the vsftpd.conf file, look for reference to "SSL encrypted connections" and add the following:

        ssl_enable=YES

rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem

rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key

Save and exit the file. You can now specific FTPS as a connection protocol in your FTP client.

5. Install an FTP Client on Ubuntu

From another system you can connect to your Ubuntu FTP server using a command line tool or desktop app.

On Linux, you can access the server in the terminal with

        sudo ftp hostname
    

Be sure to substitute "hostname" with your server's hostname. You can also use the IP address

        sudo ftp ipaddress
    

When prompted, input the username and password you set earlier. You can then use the get and put commands to transfer data.

Want something more intuitive, or accessing the FTP server from another operating system? You'll need an FTP client and arguably the best available is FileZilla. An open source solution, this is available for Windows (as well as a server), macOS, and there are 32-bit and 64-bit versions for Linux. Sadly there is no FileZilla FTP server for Ubuntu or other Linux distros.

Download: FileZilla (Free)

To use the FileZilla client to connect to your Ubuntu FTP server, install and launch the app. Then:

  1. Click File > Site Manager
  2. Here, click New site
  3. In the right-hand pane, select FTP 
  4. If you're using FTPS select TLS for Encryption.
  5. Next, input the hostname or IP address in Host and add the Port.
  6. For Logon type input your account credentials in User and Password.
  7. Click Connect.
Connect to your Ubuntu FTP server with FileZilla

You're then free to upload and download (put and get) data from your Ubuntu FTP server. Simply drag and drop the files you wish to move.

Using a different FTP client? The steps should be largely the same, but check the app's documentation for clarification.

You Built an FTP Server on Ubuntu

Whether you were using a desktop or server version of the Ubuntu operating system, it now runs an FTP server. This can be used for any number of purposes, from uploading web pages to providing easy access to important data. Using FTP you can grab the data whenever you need it without physical access to the server machine.