How to Setup FTP Server on Ubuntu 18.04

r00t July 5, 2018

Setup FTP Server on Ubuntu 18.04

In this tutorial we are going to learn how to setup FTP server on Ubuntu 18.04. We will also install and configure its prerequisites. The File Transfer Protocol (FTP) is a standard network protocol used to transfer computer files from one host to another host over a TCP-based network, such as the Internet or over LAN (Local Area Network). It is commonly used by most of the companies to share data with the customers.

I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an Ubuntu 18.04 Bionic Beaver minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.

Setup FTP Server on Ubuntu 18.04

Step 1. First, ensure your system and apt package lists are fully up-to-date by running the following:

apt-get update -y
apt-get upgrade -y

Step 2. Install and Setup FTP Server on Ubuntu 18.04.

Open terminal and type this command to install vsftpd:

sudo apt install vsftpd

Once the installation completes, start the service vsftpd and configure automatically from the next system boot:

systemctl start vsftpd
systemctl enable vsftpd

Step 3. Configuring and Securing FTP Server in Ubuntu.

First, we will create a backup of the original config file /etc/vsftpd/vsftpd.conf like so:

cp /etc/vsftpd.conf /etc/vsftpd.conf.orig

Next, open the /etc/vsftpd.conf file:

nano /etc/vsftpd.conf

Change the following lines:

# Controls whether anonymous logins are permitted or not.
anonymous_enable=NO

# Allow local users to login
local_enable=YES

# Set 'write_enable' to YES in order to allow changes to the filesystem
write_enable=YES

# to enable ASCII uploads (to prevent uploaded scripts etc. from breaking),
# without the DoS risk of SIZE and ASCII downloads. ASCII mangling should be
# on the client anyway..
ascii_upload_enable=YES
ascii_download_enable=YES

# You can set the root directory of the FTP users. if not specified, users' home directory equals FTP home directory
local_root=public_html

Save the file and close it. Then we have to restart VSFTPD services for the changes above to take effect:

systemctl restart vsftpd

Step 4. Configure Firewall.

In case you have UFW firewall enabled, execute the below command to allow incoming traffic to FTP ports:

sudo ufw allow from any to any port 20,21,10000:10100 proto tcp

Step 5. Create FTP users.

We will now create a new user that we will use to log into FTP. In this example, we will create a new user called “ftpuser”.

sudo adduser ftptest

Now you can access the ftp server from other computers of same LAN via an ftp clients like filezilla or gftp, or just access (read only) by using a web browser. You have to use the username and password of the server.

Congratulation’s! You have successfully install and setup FTP server on your Ubuntu 18.04 server. Thanks for using this tutorial installing FTP server on Ubuntu 18.04 LTS (Bionic Beaver) system.

The Tags:

Leave a Comment

Comments are closed.