How to Install FTP on Ubuntu 18.04?

Linux VPS

File Transfer Protocol (FTP) is used to share files and folders from one server to another using the Client/ Server model. Once the FTP client sends the request to the FTP Server, the FTP Daemon of the server will set a connection between the two systems. 

You can access the files hosted on your server with FTP; we have listed the steps to install FTP on Ubuntu 18.04. 

Note
It is always recommended to set Authentication for FTP instead of Anonymous. 

1. Install the FTP using this command – 

# sudo apt-get install vsftpd

2. We will set local_enable=YES to allow local users to log in to the FTP server; it should be up by default.

# sudo nano /etc/vsftpd.conf

3. To provide the write permission, we will uncomment the below line – 

# write_enable=YES

4. Make the below changes for the chroot settings – 

user_sub_token=$USER

chroot_local_user=YES

chroot_list_enable=YES

5. Inside # (default follows), set the default ‘chroot’ settings.
If any of these lines don't exist, you can add them as shown below –  

  1. chroot_list_file=/etc/vsftpd.chroot_list

    local_root=/home/$USER/Public_html

    allow_writeable_chroot=YES

  2. 6. Activate the “-R” option by uncommenting the below line –  

    # ls_recurse_enable=YES

  3. 7. Save and exit the vsftpd.conf file.

    8. Now, we will add the users to the vsftpd.chroot_list file to access their Home Directories within the server.
    We have created a test user and added it to the vsftpd.chroot_list file. 

    # sudo nano /etc/vsftpd.chroot_list

    Please note that only users added in the vsftpd.chroot_list will be able to connect to this server.

    9. Restart the vsftpd.

    # sudo systemctl restart vsftpd

    10. Get the IP Address of your server with the ifconfig command and access FTP with port 21.

    11. Access the FTP using the Username and Password of the same user from a local FTP client like FileZilla.