Hello everyone! Today, I would like to show you how to install and test an FTP server on Ubuntu Linux.
Table of Contents
According to Wikipedia:
“The File Transfer Protocol (FTP) is a standard communication protocol used for the transfer of computer files from a server to a client on a computer network. FTP is built on a client–server model architecture using separate control and data connections between the client and the server.”
I will use Ubuntu 22.04.1 LTS in my environment. As an FTP server, I will install and use the vsftpd packet.
I think that, at some point, you also needed an FTP server to store certain information that you can later access from the local network (LAN). I assume you have asked yourself how you can do this. Well, you can configure an FTP server on which you can store the desired information and which can be accessed through a web browser or from the command line.
1. Search for available software located on the repository
Since, you are using Linux, I assume that you would like to learn how to install the software by using the command line and not the Ubuntu Software Packet Manager.
In order to install a program by using the command line interface, you will need to open the terminal, by pressing right click and by selecting “Open in terminal”
Once you opened the terminal, run the below command, which searches for applications located in the repository.
apt-cache search vsftpd
2. Install the package for the FTP server
After you have identified the required package, go ahead and install it. To do this, you need to have administrative privileges. You can use sudo or login as the root account. The root account is similar to the administrator account on a machine running Windows. Without the administrative privileges, you will not be able to install any software.
You need to run the command:
sudo apt-get install vsftpd
3. Verify that the FTP server is running
After you have finished the installation, you need to check if the FTP is running. To accomplish this task, you have 2 possibilities.
You can run the command:
systemctl status vsftpd.service
sudo ss -tlpn | grep vsftpd
4. Install an FTP client with graphical user interface (GUI)
The next step in your journey is to test the FTP server. You can test the FTP server by using an FTP client like FileZilla or by using the command line.
I will show you both methods.
First, we will need to install the FTP client. I will use FileZilla for this purpose. It is an Open Source software, so you do not need to pay for using it. This time, I will use the Ubuntu Software Packet Manager. Open the Ubuntu Software Packet Manager and search for FTP.
After you have identified the require software, in our case FileZilla, press the install button. After pressing the install button, you will need to enter your password (I assume that you have administrative privileges and are able to install software).
5. Test the FTP server
After you have finished the installation of the FTP client, open it and test the FTP server.
Open FileZilla and connect to your FTP server. In my lab, the FTP server and the FTP client are running on the same machine. So, in order to connect to the FTP server, I will specify localhost as the host and I will use my username and my password to connect to the FTP server.
Accept the insecure connection. If you are connecting to an FTP server located on the Internet, do not accept the insecure connection because all your login details and all other data is sent in plain text. Someone can intercept the traffic and steal your login credentials (Man in the Middle Attack).
Now, you are connected. You can start to transfer files to your FTP server.
In order to transfer the file(s) to the FTP server, you need to locate it. On the left side of the FileZilla window is your local computer, on the right side of the FileZilla window is your FTP server. If you want to download a file from FTP server, just locate it. After you located the file, press right click and select the Download button.
If you need to upload a file, identify it on the left side of the FileZilla window, press right click on your mouse and press upload.
Unfortunately, as you can see from the above image the upload failed. In order to address this issue, we will need to change the default configuration of our FTP server. We will need to open the file vsftpd.conf and change the option write_enable to YES, or remove the # sign from the option. By default you do not have permission to upload files to the FTP server.
To edit the file, you can use vim or any other text editor, such as nano.
sudo vim /etc/vsftpd.conf
After you have modified the vsftpd.conf file, save it and exit. Every time you change something in a configuration file, do not forget to restart the service. Otherwise, it will not work.
To restart the service run the below command:
sudo systemctl restart vsftpd.service
Finally, you can upload a file to your FTP server.
You can perform the same operations from the command line.
ftp localhost ls cd Desktop ls get test.txt
To upload a file via command line, run the below command:
To exit from the FTP server, you need to run the bye command.
It seems that the test was successful. I hope you will find this post useful.
PS: If you liked the article, please leave your comment below.
[…] time, I explained how to install and use an FTP server. I used vsftpd in my […]