When you try to set up the Linux server, you will need the File Transfer Protocol (FTP) server so that you can gain access to the FTP. The File Transfer Protocol is a system used for uploading and downloading the files, images, etc. from a server. No matter which kind of server setup you’re trying to build in your Ubuntu desktop, you’ll need the FTP server for an easy mode of data transfer between two systems. Installing an FTP server on Ubuntu is easy, but you need to configure it with vsftpd, and here is how to do it:
Your system might already have vsftpd and to check its availability, open the terminal window, and insert the following command:
“sudo apt list –installed”
Somewhere near the bottom of the list, you’ll find vsftpd. If not, then install it using the following command:
“sudo apt install vsftpd”
Start configuring vsftpd after installation, but first, make a copy of the original config file. It will ensure that your default config will remain safe even if anything goes wrong with the procedure.
“sudo cp /etc/vsftpd.conf /etc/vsftpd.conf_default”
Then launch the service with the following command:
“sudo systemctl start vsftpd”
Confirm that the server is running with:
“sudo systemctl enable vsftpd”
Start configuration, once the vsftpd gets installed on your desktop.
Create an FTP User
For this procedure, you will need an FTP user account to use any FTP client for accessing the files hosted on the server using the vsftpd. Insert the following command in the terminal:
“sudo useradd -m username”
In this command, write the username you want in place of “username”
Then, enter: “sudo password username”
In the created account’s home folder, create a test file to confirm if it works. Use this command:
sudo nano testfile.txt”
Initially, when you get connected to the Ubuntu FTP server, you’ll see the testfile.txt.
Secure your server
Before setting up any further connection, check if the FTP ports are open because the security terms in the Uncomplicated Firewall keeps it closed by default. To get access via port 20, use the following command:
“sudo ufw allow 20/tcp”
If your system distros use an alternative, then check the documentation properly to open the ports. You might want the users to upload the files, and for that, you can set changes in the config file. Use the following command to edit:
“sudo nano /etc/vsftpd.conf”
Then, find ‘write_enabled’ and uncomment the entry. Set your confirmation with “YES” and use this command:
Press Ctrl + X keys to exit, and press the Y key to save.
You can also restrict the access of each user to its home directory.
In the vsftpd.conf, find and uncomment this line (remove the #):
Again, press the Ctrl + X keys to exit, and Y key to save.
If multiple users are going to share the system, then it is better to maintain a list. First, open vsftpd.chroot_list in your text editor, and enter:
sudo nano /etc/ vsftpd.chroot_list
On the following page, you can restrict access by listing the usernames to their folders. Save and exit the page, and return to vsftpd.conf. Make sure that the chroot_local_user=YES is uncommented:
Again, save and exit, and restart the FTP service with this command:
sudo systemctl restart vsftpd.service
Now, you can use the Hostname command to check the name of your Ubuntu server, and use this to connect to the FTP server. You can also use the IP address command and make a note of it.
Encrypt the connections
Using SSL or TSL, you can force traffic encryption to and from your Ubuntu FTP server. On the vsftpd.conf file, you can check the reference to ‘SSL encrypted connections and insert the following command:
Save & exit the file, and now, you can set the FTPS as a connection protocol in your FTP client.
Install FTP Client
On your Linux desktop, insert the following commands to access the server in the terminal:
“sudo ftp hostname” (Here, replace the hostname with your server’s hostname.)
You can also use the IP address.
“sudo ftp ipaddress”
Insert the same username and password as earlier, and you’ll be able to transfer data. If you want a more intuitive system, then download FileZilla and use it to connect to the Ubuntu FTP server. After installing and launching the app, use these steps:
- Click on File and select Site Manager. Click on New site, and from the right-hand side, select FTP.
If you’re using FTPS, select TLS for Encryption.
- Insert the hostname or IP address in Host and add the Port.
- For Logon type, feed in your account details in the User and Password section.
- Click on Connect.
Now, you can easily upload and download the data from your Ubuntu FTP server by dragging and dropping the files. Use this guide for an easy installation procedure. Make sure that you insert all the commands correctly.