How To Setup FTP Server In Linux/Unix?

FTP is the short form of File Transfer Protocol. It is a standard networking protocol used to transfer files between client and server. An FTP user may authenticate themselves by using username and a password. For secure transmission of username or password or other encrypted content that is to be transferred, FTP is often secured with the SSL/TLS(FTPS) or replaced with SSH File Transfer Protocol(SFTP). FTPD, VSFTPD, PROFTPD, and PUREPTPD are some examples of FTP servers used in Unix or Unix based systems.

What is vsftpd?

VSFTPD stands for “Very Secure File Transfer Protocol Daemon”. Using FTP without including any type of security layers likes SSL/TLS is insecure, and anyone should avoid this because it transmits data without encryption. So It is recommended to use a secure version of FTP such as SFTP. In this article, we are going to discuss installing and configuring vsftpd which is a type of secure FTP server.

Installing vsftpd

To install vsftpd in your system use the following commands(In debian based systems) –

sudo apt-get update
sudo apt-get install vsftpd

Enable vsftpd services

Start the vsftpd services by using the given command-
systemctl start vsftpd
systemctl enable vsftpd

Create an FTP directory and grant required permissions –

So before starting, we need to create a user for FTP access-
sudo adduser testuser

Next, create an FTP directory and set ownership by using the given command-

sudo mkdir /home/testuser/ftp
sudo chown nobody:nogroup /home/testuser/ftp
sudo chmod a-w /home/testuser/ftp

Now create a directory where files can be uploaded by testuser –
sudo mkdir /home/testuser/ftp/test
sudo chown testuser:testuser /home/testuser/ftp/test

Configure vsftpd server

The configuration of vsftpd is saved in a file called vsftpd.conf which resides inside /etc/ directory of the system. For the secure implementation of the vsftpd server, we have to add/modify some options inside the vsftpd configuration file. But before making any changes to the configuration file, It is good to take the backup of the original file. The same can be done by using the given command-
sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.orig

Now open the configuration file by using a text editor-
sudo nano /etc/vsftpd.conf

And add or uncomment the following options that are given inside the vsftpd.conf file –


Save the edited file by pressing ctrl+o followed by the return key. The options in the configuration file can be added or modified according to your needs.

Now we need to add testuser into /etc/vsftpd.userlist file to allow FTP access. Use the following command to open the file using a text editor –
sudo nano /etc/vsftpd.userlist
Now add the testuser in this file and press ctrl+s to save and ctrl+x to exit from the editor.
Restart the vsftpd services –
sudo systemctl restart vsftpd

To check the status of FTP server use the following command –
sudo systemctl status vsftpd

As you can see in the image server is active(running). Now it is ready for use.

Accessing FTP server

The FTP server can be accessed by using a web browser or an FTP client application like Filezilla. To access from web browser use the URL of the site like or use the localhost IP address if your FTP server is running locally. For example – Enter in your browser and press enter it will ask you to enter username and password. Enter the username that you have created before, and password and press enter to proceed. It will display the files and directories of the system. You can enable the SSL/TLS to encrypt the data transferred via FTP.

I hope this will gives you a basic understanding of implementing the FTP server in your system. At any step, if you find yourself stuck feel free to write us in the comments below.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Exit mobile version