Check Vsftpd service is active

Install VSFTPD FTP Server on Ubuntu 20.04 LTS Linux

Posted on

This tutorial is to understand how we will set up, config, setup, and use the VSFTPD FTP server on Ubuntu 20.04 LTS Focal Fossa utilizing the command terminal.

Vsftpd is an FTP server that could be very consciously designed for safety. For instance, this system checks its configuration and the rights of all information it’s to entry earlier than beginning and refuses to begin whether it is configured incorrectly. We are able to use this open-source program to arrange an FTP server on Ubuntu Linux. Listed here are the instructions to comply with:

Steps to put in and VSFTPD FTP Server on Ubuntu 20.04

The steps given right here can be utilized on Ubuntu 20.04 as effectively together with Debian 11, Linux Mint, and different related Linux distros.

1. Replace Ubuntu 20.04

Let’s begin with the operating of the system replace command as a result of we’re going to use an APT package deal supervisor to put in VSFTPD. Due to this fact, this step ensures all the most recent accessible updates are on our system.

sudo apt replace && sudo apt improve

2. Set up VSFTPD on Ubuntu 20.04

We don’t want so as to add any third-party repository or obtain any deb binary manually as a result of the official Ubuntu repository is sufficient; use the APT package deal supervisor command given beneath and you’re achieved:

sudo apt set up vsftpd

3. Examine Vsftpd service is energetic

As soon as the set up is accomplished, let’s verify the service of this FTP server is operating within the background with out producing any errors.

systemctl standing vsftpd --no-pager -l
Check Vsftpd service is active

4. Create a person for FTP on Ubuntu 20.04

Let’s create a person that won’t have sudo entry and we solely use it to entry a particular folder below its dwelling listing for FTP to learn and write information.

sudo adduser h2smedia

Notice: Change h2smedia with no matter title you need to give to your person. The above command can even ask you to set the password for the person.

5. Create the FTP folder:

Now, let’s create a folder below the house listing of the newly created person in order that the person can solely entry that to add and obtain information. Nonetheless, to limit the person’s entry to solely some particular listing vsftpd makes use of chroot that we additionally have to allow, which we do later on this article. But, there may be yet one more drawback, it’s VSFTPD is not going to enable a person to hook up with the FTP server if the house listing is writable. Due to this fact, we create a root listing for a person named- FTP below the person’s dwelling that can act as- chroot, and inside that, there will probably be one other listing generally known as add to carry the information.

Notice: Don’t neglect to Substitute h2smedia along with your created person.

sudo mkdir /dwelling/h2smedia/ftp

Configure possession:

sudo chown no person:nogroup /dwelling/h2smedia/ftp

Take away the basis FTP folder writable permission:

sudo chmod a-w /dwelling/h2smedia/ftp

Create a listing to add information, which going to carry your information:

sudo mkdir /dwelling/h2smedia/ftp/add

Give created add  folder possession to our FTP person

sudo chown h2smedia:h2smedia /dwelling/h2smedia/ftp/add

Now to check, let’s a create demo file contained in the add folder:

echo "My FTP Server" | sudo tee /dwelling/h2smedia/ftp/add/demo.txt

Lastly, verify the permission for the FTP listing:

sudo ls -la /dwelling/h2smedia/ftp
Create FTP server user

6. Configuring VSFTPD on Ubuntu 20.04

After set up, the configuration file /and so forth/vsftpd.conf have to be tailored to your individual wants with an editor. The file is commented on intimately. Nonetheless, an important settings are defined beneath.

sudo nano /and so forth/vsftpd.conf

7. The right way to allow Nameless person

(elective) By default as a result of safety causes, no person can log in to the FTP server anonymously (with out utilizing a sound person). Nonetheless, as a result of any cause, if you wish to allow it then discover a line- anonymous_enable=No and alter NO to YES.

8. Allow Native FTP person

Effectively, to entry the FTP server utilizing the customers you’ve created and accessible in your system, you’ll be able to search for a line given beneath in Vsftpd config file on Ubuntu 20.04:


By default, it’s set to YES or enabled, therefore there isn’t any have to do something.

9. Allow file & folder add

Within the primary configuration, no person is allowed to write down through FTP. Neither native customers (if they’re allowed by “local_enable=YES”), nor nameless customers.  To allow importing of information to FTP server, we have to

# Uncomment this to allow any type of FTP to write down a command.

VSFTPD FTP Enable file folder upload

10. Limit native customers to their dwelling listing

Now, limit native customers to their dwelling directories. So, that they will’t entry the information outdoors of their dwelling directories. Discover the beneath line and take away the # given in entrance of it to allow it.

Restrict local users to their home directory

Scroll to the tip of the file and the next strains, this can be sure that when a person login the FTP server, it routes to the listing that’s meant to be accessed.


Set Passive ports:

The Vsftpd makes use of energetic mode by default on ports – 20 / 21 to speak if you wish to arrange passive mode as effectively which works if there may be some firewall situation between shopper and server. Nonetheless, each the server and the shopper should assist passive FTP mode for this course of to work. Nonetheless, the passive ports have to be allowed within the server firewall. Know about its configuration.


Additionally, add the next strains which be sure the VSFTPD solely permits the entry of customers to the FTP server that are in its listing not anybody randomly.

userlist_file=/and so forth/vsftpd.userlist

Save the file by utilizing Ctrl+O, hit the Enter Key, and Exit the file utilizing Ctrl+X.

Additionally, don’t neglect to open ports within the firewall, if you’re utilizing UFW then use this command different wiser open the system in your cloud or community firewall. Port 900 is for TLS.

sudo ufw enable 20,21,990/tcp
sudo ufw enable 30000:31000/tcp

11. Add created person to the VSFTPD Consumer listing

Subsequent, add the created person to the VSFTPD person listing file, in order that it permits that person to log in and entry the FTP server.

echo "h2smedia" | sudo tee -a /and so forth/vsftpd.userlist

Notice: Substitute h2smedia along with your created person.

12. Restart the VSFTPD Server

To use the modifications we now have made to date, restart the FTP server service as soon as:

sudo systemctl restart vsftpd

13. Connect with Take a look at Ubuntu 20.04 FTP Server

We are able to use each the command line and GUI app to check the server to know whether or not it’s working or not. Let’s first strive with the command line:

Utilizing Command line

-p is for passive mode

ftp -p

Notice: Substitute along with your Ubuntu 20.04 Server deal with the place VSFTPD is put in.

Because it requested for a Title, enter the FTP server username after which the password, you’ve set. If in case you have configured all the pieces proper, it is possible for you to to log in.

Connect to Test your FTP Server VSFTPD command

Take a look at Utilizing File Zilla

Right here we’re utilizing GUI FTP shopper FileZilla, you should use some other you’ve. In your FTP shopper enter the IP deal with of the Ubuntu 20.04 server the place you’ve configured the VSFTPD. After that add the username and password.

Connect to Test your FTP Server VSFTPD FileZilla

14. Setup SSL/TSL for Vsftpd on Ubuntu 20.04

By default, the information switch utilizing the Vsftpd FTP server is not going to be in an encrypted format even the credentials, to take away this safety flaw we will configure SSL utilizing OpenSSL to offer encryption.

In your command terminal, first, run:

sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout /and so forth/ssl/non-public/vsftpd.pem -out /and so forth/ssl/non-public/vsftpd.pem

This may generate the required 2048-bit non-public key and self-signed SSL certificates.

After you have generated the SSL certificates, edit the VSFTPD configuration file and add the situation of the Personal key and SSL certificates to that.

sudo nano /and so forth/vsftpd.conf

Scroll down to search out the next strains and alter their values as proven additional:

rsa_cert_file=/and so forth/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/and so forth/ssl/non-public/ssl-cert-snakeoil.key

Change the values of rsa_cert_file and rsa_private_key_file directives with the trail of the SSL & Personal key file we now have generated. Additionally, change ssl_enable=NO to ssl_enable=YES. As proven beneath:

rsa_cert_file=/and so forth/ssl/non-public/vsftpd.pem
rsa_private_key_file=/and so forth/ssl/non-public/vsftpd.pem
Setup SSL TSL for Vsftpd Ubuntu 22.04

Additionally, scroll to the tip of the file and add:


This may deny entry to Nameless connection over SSL and power customers to switch information and log in utilizing SSL solely:

Save the file utilizing Ctrl+O, hit the Enter key, after which exit utilizing Ctrl+X.

Restart the FTP server:

sudo systemctl restart vsftpd

Now, verify whether or not we will entry the FTP server over TSL or not. Right here we’re utilizing once more the FileZilla:

Accept self signed certificate for FTP server
Install VSFTPD FTP server on Ubuntu 20.04 Linux Focal

15. The right way to replace VSFTPD

As we now have used the default system repository to put in VSFTPD open supply FTP server on Ubuntu 20.04, therefore we will use the system replace and improve command as effectively to get future updates for this server software.

sudo apt replace && sudo apt improve

16. Uninstall or Take away

To utterly uninstall VSFTPD from Ubuntu 20.04, in case you don’t require this FTP server anymore in your system. Then, right here is the command to comply with:

sudo apt autoremove --purge vsftpd*

offshore vps