Networking

How to quickly set up an FTP server on Ubuntu 18.04

If you need an FTP server up and running quickly, you can't beat the ease of VSFTP. Jack Wallen shows you how to install and configure it in minutes.

linuxnetworkhero.jpg
Image: Jack Wallen

You've migrated all of your Ubuntu Linux servers to the latest iteration and need to get an FTP server up and running quickly. How do you manage that task? It's actually incredibly easy. I'm going to show you how to do just that, using the VSFTP server.

VSFTP is a very secure and fast FTP daemon that makes setup and administration very simple. Let's get this up and running.

What you'll need

Obviously, you'll need Ubuntu Server 18.04 installed and running. Outside of that, you'll need an account with sudo privileges and a few minutes time.

SEE: IT pro's guide to working smarter with Linux (Tech Pro Research)

Installing VSFTP

The VSFTP daemon is found in the standard repositories, so installation can be pulled off with a single command. Open a terminal window and issue the following:

sudo apt-get install vsftpd

Start and enable the service with the commands:

sudo systemctl start vsftpd
sudo systemctl enable vsftpd

Once that installation completes, you're ready to continue.

Creating an FTP user

We're going to make this very easy and create a user for the FTP service that you can then give out to those who need it (and don't have a user account on the server). This could be considered an account for generic FTP usage. You can always create more, and anyone with a user account on the server can log via FTP. Our user will be called ftpuser and is created with the command:

sudo useradd -m ftpuser

Set the user's password with the command:

sudo passwd ftpuser

Your user is ready to go.

Configuring VSFTP

We're going to create a brand new configuration file. Before we do that, let's rename the original with the command:

sudo mv /etc/vsftpd.conf /etc/vsftpd.conf.orig

Create the new file with the command:

sudo nano /etc/vsftpd.conf

In that file, place the following:

listen=NO
listen_ipv6=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO
pasv_enable=Yes
pasv_min_port=10000
pasv_max_port=10100
allow_writeable_chroot=YES

Logging in

At this point, you should be able to log into your FTP server using the ftpuser created earlier. Login with your favorite FTP GUI client or the command line. You can now upload and download files to your heart's content. Those files will be saved in the home directory of the ftpuser user (so /home/ftpuser). With our configuration file, we've disabled anonymous usage, so the only way to log in will be with a working account on the server.

Done and done

That's it. In about a minute, you've created an FTP server on Ubuntu 18.04. It really is that easy. Remember, however, this is pretty basic. The goal was to get it up and running quickly, so you might find it doesn't perfectly fit your needs. Fortunately, VSFTP is a fairly flexible server. To learn more about what this FTP server can do, issue the command man vsftpd.

About Jack Wallen

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website jackwallen.com.

Editor's Picks

Free Newsletters, In your Inbox