How to Install FTP Server on Ubuntu 18.04

What is FTP?

FTP or File Transfer Protocol is a protocol for transferring files between computers on the internet over TCP/IP connections.

The FTP was designed for client-server architecture, all files stored at the server accessible through FTP clients.

In this tutorial, we will show you how to set up the FTP server on Ubuntu 18.04 using the vsftpd.


For this tutorial, make sure you have got an Ubuntu 18.04 server with root privileges.

Below is the tutorial about the Ubuntu 18.04 server installation.

Install Ubuntu 18.04 Server

Before going any further, log in to your Ubuntu server and type the sudo command to get the root privileges on your system.

sudo su

Step 1 – Install vsftpd on Ubuntu

First, we will install the vsftpd packages from the official Ubuntu repository.

Update the Ubuntu repository to the latest and install the vsftpd package using the apt command below.

sudo apt update
sudo apt install vsftpd

Once the installation is complete, start the vsftpd service and add it to the system boot.

systemctl start vsftpd
systemctl enable vsftpd

As a result, you’ve installed the vsftpd package to Ubuntu 18.04 server.

Install vsftpd on Ubuntu 18.04

Step 2 – Set Up New User

In this step, we will add a new user for the vsftpd server and add the FTP directory.

Add a new user using the command below (here we will add a new user called ‘gahyeon‘).

adduser gahyeon

Type the password for your user and you’ve added a new user.

Add a new user for FTP server

Next, create a new FTP directory under on the ‘/home/username’ directory.

mkdir -p /home/gahyeon/ftp

Change the ownership of the FTP directory to your user and remove the write permission on it.

chown -R nobody:nogroup /home/gahyeon/ftp
chmod a-w /home/gahyeon/ftp

After that, create a new directory ‘files’ that will be used for storing user upload files.

mkdir -p /home/gahyeon/ftp/files
chown -R gahyeon:gahyeon /home/gahyeon/ftp/files

As a result, you’ve created a new user and its FTP directory. The user is allowed to upload files to the ‘files’ directory.

Setup FTP directory

Step 3 – Configure vsftpd

In this step, we will copy and edit the default vsftpd configuration.

Before editing the vsftpd defualt configuration ‘/etc/vsftpd.conf’, backup the original file.

cp /etc/vsftpd.conf /etc/vsftpd.conf.bak

Now edit the ‘/etc/vsftpd.conf’ configuration using vim editor.

vim /etc/vsftpd.conf

– Enable Local Users Support

First, enable the local user support by uncommenting the following line.


– Enable User Upload and Setup Default Permission

Now enable upload for all users and set up the default permission for uploaded files to ‘022’, which the most used permission for other ftpd’s.


– Specify vsftpd Log

Next, we will set up the custom for vsftpd and enable a chroot for all users.

Uncomment the following configuration to specify the vsftpd log to the ‘/var/log/vsftpd.log’ file.


– Enable chroot Support

Now enable chroot vsftpd for all users using the following configuration.


The chroot feature is used to restrict local users to their home directory.

– Set Up user_sub_token

After that, add the ‘user_sub_token’ to insert the username to the FTP path directory.


– Set Up vsftpd Passive Connection Ports

Now specify the range of port for the passive vsftpd support. Set up the ‘pasv_min_port’ for minimal port number, and ‘pasv_max_port’ for max port number.


– Set Up User List

Now enable the user list support, specify the list user file to ‘/etc/vsftpd.user_list’, enable deny support for all users that are not listed on the configuration.


Save and close.

– Add vsftpd User to the User List

Next, add your user to the vsftpd user file ‘/etc/vsftpd.user_file’ using the command below.

echo 'gahyeon' | sudo tee /etc/vsftpd.user_list
cat /etc/vsftpd.user_list

Now restart the vsftpd service.

systemctl restart vsftpd

As a result, you’ve successfully set up the vsftpd on the Ubuntu server. The vsftpd is up and running, and ready to test.

Configure vsftpd on Ubuntu 18.04

Step 4 – Testing

Now we will test our set up of the FTP Server on Ubuntu system. And we will use the command-line FTP client for this testing.

Connect to the FTP server using the following command.

ftp -p

The -p option is used to connect to the FTP server using the range of passive port.

Now type your user and password (here we’re using the user ‘gahyeon‘).

Once you’ve logged in, you will get the ‘230 Login successful‘ message as below.

Set up FTP Server on Ubuntu 18.04

Next, go to the ‘files’ directory and upload the ‘test.txt’ into it. This is used for test writable testing.

cd files/
send test.txt

And you will get the result as below.

Set up FTP Server on Ubuntu 18.04

As a result, you’ve successfully uploaded the file to the ‘files’ directory.

Finally, you’ve successfully set up the FTP server on Ubuntu 18.04 using the vsftpd.

Recommended: Secure FTP Server with SSL/TLS Encryption

Write A Comment