The best way to Set up an FTP Server on Ubuntu in 5 Steps

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

What is FTP function


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

What is an FTP server?

FTP, or File Transfer Protocol, is the system used to upload (put) or download (retrieve) files from a server. You've likely used it without realizing it in the past, when retrieving files or uploading pictures to the web. Or, you used an FTP client to connect directly to the FTP file server.

To do this, the FTP server software must be installed on the remote server on which the files are located.

Whether you're building a Linux home server, a web server, a game server, or a server suitable for your project, FTP is the easiest way to move data from one system to another.

Install a server on Ubuntu

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

1. Install vsftpd

Vsftpd may already be installed. To check, open a terminal window and enter

sudo apt list – installed

You should find vsftpd at the bottom of the list. If not, just install it

sudo apt install vsftpd

After the installation, it's time to configure vsftpd. First, make a copy of the original configuration file. That is, if something goes wrong, the default configuration can be restored.

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

Then start the service with:

sudo systemctl start vsftpd

Confirm the server is running with:

sudo systemctl enable vsftpd

With vsftpd installed, you can start configuring.

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, enter:

sudo useradd –m username

(Replace "username" with your intended username.)

sudo password username

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

cd / home / username
sudo nano testfile.txt

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

3. Back up your Ubuntu FTP server

However, before you can connect, you need to make sure that the FTP ports are open in Ubuntu. By default, these are closed in ufw (Uncomplicated Firewall) for security reasons.

Use to enable access over port 20

sudo ufw allow 20 / tcp

If your distribution uses a different firewall or you have installed an alternative, see the documentation to open the ports.

You also want users to be able to upload files. You can set this in the configuration file. Open it for editing:

sudo nano /etc/vsftpd.conf

Find write_enabled and uncomment the entry and make sure it is set to "YES":

write_enable = YES

Beat Ctrl + X. to leave, and Y. to save.

With publicly accessible FTP servers, you should limit the access of each user. With chroot we can restrict every user to their home directory. In vsftpd.conf, find and comment out this line (remove the #):

chroot_local_user = YES

Once again, Ctrl + X. to leave, 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

List the usernames here that you want to restrict to their own folders. Save and exit, then return to vsftpd.conf and make sure that chroot_local_user = YES is uncommented:

# chroot_local_user = YES

Instead, comment out

chroot_list_enable = YES


chroot_list_file = / etc / vsftpd.chroot_list

It should look like this:

Configure an FTP server in Ubuntu

Save and exit again. 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 the IP address, enter that IP address command and write it down.

4. Encrypted connections: FTP + SSL = FTPS

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

Related: Encryption Terms Everyone Should Know

Find references to "SSL Encrypted Connections" in the vsftpd.conf file 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 specify FTPS as the 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.

Under Linux you can access the server in the terminal with

sudo ftp hostname

Make sure to replace "hostname" with the hostname of your server. You can also use the IP address

sudo ftp ipaddress

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

Would you like something more intuitive or would you like to access the FTP server from a different operating system? You need an FTP client and arguably the best one available is FileZilla. This open source solution is available for Windows (as well as a server) and MacOS. There are 32-bit and 64-bit versions for Linux. Unfortunately there is no FileZilla FTP server for Ubuntu or other Linux distributions.

Download: FileZilla (free)

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

  1. click File> Site Manager

  2. Click here New page

  3. Select in the right pane FTP

  4. If you are using FTPS, choose TLS to the Encryption.

  5. Next, enter the host name or IP address host and add the port.

  6. To the Login type Enter your account credentials in Users and password.

  7. click Connect.

Connect to your Ubuntu FTP server using FileZilla

You can then upload and download (drop and retrieve) data from your Ubuntu FTP server. Just drag and drop the files you want to move.

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

You have created an FTP server on Ubuntu

Whether you used a desktop or server version of the Ubuntu operating system, an FTP server is now running. This can be used for any number of purposes, from uploading web pages to easily accessing important data. With FTP, you can retrieve the data at any time without having physical access to the server.

Peer network computer sharing

How Peer-to-Peer (P2P) File Sharing Works

Software piracy and file sharing existed long before the Internet as we know it today, primarily through message boards and private FTP sites. But it was tedious to find files and even slower …

About the author

Christian Cawley
(1410 articles published)

Deputy Editor for Security, Linux, DIY, Programming and Technology explains. He also produces The Really Useful Podcast and has extensive desktop and software support experience.

Christian is an employee of Linux Format Magazine and a Raspberry Pi hobbyist, Lego lover and retro gaming fan.

More from Christian Cawley

Subscribe to our newsletter

Sign up for our newsletter to receive tech tips, reviews, free e-books, and exclusive offers!

One more step …!

Please confirm your email address in the email we just sent you.

. "border =" 0

Leave a Reply

Your email address will not be published. Required fields are marked *