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.
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.
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.
You might already have vsftpd installed. To check, open a terminal window and input
You should find vsftpd near the bottom of the list. If not, simply install with
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.
With that done, launch the service with:
Confirm the server is running with:
With vsftpd installed you can begin configuration.
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:
(Substitute “username” with your intended username.)
With the username and password set, create a test file in the account’s home folder to confirm it works:
When you first connect to your Ubuntu FTP server, you should see testfile.txt.
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
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:
Find write_enabled and uncomment the entry, ensuring it is set to “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 #):
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.
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:
Instead, uncomment
and
It should look like this:
Again, save and exit. Finally, restart the FTP 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.
You can also force encryption of traffic to and from your Ubuntu FTP server using SSL/TLS.
In the vsftpd.conf file, look for reference to “SSL encrypted connections” and add the following:
Save and exit the file. You can now specific FTPS as a connection protocol in your FTP client.
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
Be sure to substitute “hostname” with your server’s hostname. You can also use the IP address
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:
- Click File > Site Manager
- Here, click New site
- In the right-hand pane, select FTP
- If you’re using FTPS select TLS for Encryption.
- Next, input the hostname or IP address in Host and add the Port.
- For Logon type input your account credentials in User and Password.
- Click Connect.
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.
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.