This article shows you how to set up and connect to an FTP server using an Ubuntu Linux computer. FTP servers are used to store files and data and make them accessible to other users remotely. To be able to configure and use an FTP server on your computer, you must first install the relevant service. Before starting it is advisable to update your Ubuntu system to the latest version available.
Steps
Part 1 of 4: Install the FTP Framework
Step 1. Make sure the Ubuntu OS is up to date
Ubuntu version 17.10 has changed the paths of a wide variety of system files, so to avoid problems following the procedure described in the article it is good to update your Linux system with the latest version available. Follow these instructions:
- Open a window Terminal;
- Type the command sudo apt-get upgrade and press the Enter key;
- Type in your user password and press the Enter key;
- When prompted, press the y and Enter keys in succession;
- Wait until the updates have been downloaded and installed, then restart your computer if prompted.
Step 2. Open a "Terminal" window
Access the menu Applications pressing the button ⋮⋮⋮, then scroll through the list to locate and select the black and white icon Terminal.
Alternatively you can simply press the key combination Alt + Ctrl + T
Step 3. Use the "VSFTPD" installation command
Type the following text string sudo apt-get install vsftpd into the "Terminal" window and press the Enter key.
Step 4. Provide your system login password
This is the same password you use to log into your user account. Type in and hit the Enter key.
Step 5. Wait for the "VSFTPD" command to run
Depending on your current FTP service settings and internet connection speed, this step may take between 5 and 20 minutes to complete, so please be patient.
Step 6. Install FileZilla
It is a program created to connect to an FTP server and manage the transfer of data to and from the server. To proceed with the installation follow these instructions:
- Type the command sudo apt-get install filezilla;
- If prompted, enter the password again;
- Wait for the installation to complete.
Part 2 of 4: Configure the FTP Server
Step 1. Access the "VSFTPD" configuration file
Type the command sudo nano /etc/vsftpd.conf inside the "Terminal" window and press the Enter key. To enable or disable certain functions of the "VSFTPD" FTP service, the content of the indicated file must be modified.
Step 2. Authorize local users to log into your FTP server
Use the directional arrows on your keyboard to scroll through the contents of the file and locate the following section
# Uncomment this to allow local users to log in.
then delete the "#" from the beginning of the line of text below
local_enable = YES
- Move the text cursor to the letter on the right of the "#" symbol using the arrow keys on the keyboard (in this case a "w") and press the ← Backspace key on the keyboard.
-
If the line under consideration
write_enable = YES
- already appears blank, skip this step.
Step 3. Enable the use of FTP write commands
Use the directional arrows on your keyboard to scroll through the contents of the file and locate the following section
# Uncomment this to enable any form of FTP write command., then delete the "#" from the beginning of the line of text below
write_enable = YES
-
If the line under consideration
write_enable = YES
- already appears blank, skip this step.
Step 4. Disable the "ASCII mangling" feature
Scroll the text to the section named
# ASCII mangling is a horrible feature of the protocol.
then delete the "#" symbol from the beginning of the following two lines of text:
-
ascii_upload_enable = YES
-
ascii_download_enable = YES
Step 5. Change the settings of the "chroot" feature
Scroll the text to the section
# chroot)
then add the following lines of code:
-
user_sub_token = $ USER
-
chroot_local_user = YES
-
chroot_list_enable = YES
- If any of the above lines of code already exist, just remove the "#" at the beginning of each line.
Step 6. Change the default settings of the "chroot" feature
Scroll through the configuration file to the section
(default follows)
then add the following lines of code:
-
chroot_list_file = / etc / vsftpd.chroot_list
-
local_root = / home / $ USER / Public_html
-
allow_writeable_chroot = YES
- If any of the above lines of code already exist, just remove the "#" at the beginning of each line.
Step 7. Enable the "ls recurse" feature
Scroll through the configuration file to locate the section named
# You may activate the "-R" option…
then remove the "#" symbol from the line of code
ls_recurse_enable = YES
present within the section.
Step 8. Save the changes to the configuration file and close the text editor
Follow these instructions:
- Press the key combination Ctrl + X;
- Press the y key on your keyboard:
- Press the Enter key.
Part 3 of 4: Adding Usernames to the Chroot File
Step 1. Open the "chroot" text file
Type the command sudo nano /etc/vsftpd.chroot_list inside the "Terminal" window and press the Enter key.
If you don't need to specify the list of user accounts that can access your FTP server, you can go directly to the last step of this section of the article
Step 2. Enter your system login password
This is the same password you use to log into your user account. Type in and hit the Enter key. The contents of the "chroot" file will be displayed within the system editor.
If you are not required to provide your login password, skip this step
Step 3. Enter the accounts in the list
Type the username of your own profile and press the Enter key, then repeat the step for all the accounts of the people you want to be able to remotely access their Home folders on your FTP server.
Step 4. At the end of the compilation save the changes
Press the key combination Ctrl + X, then successively press the y and Enter keys on your keyboard. All changes made to the "chroot" configuration file will be saved.
Step 5. Restart the "VSFTPD" server
Type the command sudo systemctl restart vsftpd and press the Enter key. This will cause the "VSFTPD" FTP service to be stopped and restarted automatically, making all configuration changes effective. At this point you can start using your FTP server.
Part 4 of 4: Log in to the FTP Server
Step 1. Determine the URL of your FTP server
If you have subscribed to a web hosting service that hosts the FTP server you have created (for example Bluehost), you will need to know the IP address of the platform or the URL to connect to in order to access the server.
-
If you have installed the FTP server directly on your computer, you will need to use the IP address of the latter which you can find using the ifconfig command in a normal "Terminal" window. In this case the IP address is shown next to "inet addr".
If the "ifconfig" command is not present in the Linux distribution installed on your computer, you can add it using this command sudo apt-get install net-tools inside the "Terminal" window
Step 2. Enable port forwarding on the router that manages your LAN
Once you know the IP address of the FTP server, you will need to enable port forwording of communication port 21 on that address. Make sure you do this for TCP only and not UDP (or a combination of the two).
The port forwarding configuration procedure varies from router to router, so carefully follow the instructions contained in the article indicated or refer to the online documentation relating to the brand and model of the device in your possession
Step 3. Launch FileZilla
Type the filezilla command in the "Terminal" window and press the Enter key. After a few moments you will see the FileZilla graphical interface appear.
If you need to use the "Terminal" window directly to connect to the FTP server, type the command ftp [IP_address / URL]. If the indicated server is active and the internet connection is working properly, you should be able to connect. However, you may not be able to transfer files
Step 4. Access the File menu
It is located in the upper left corner of the FileZilla window. A small drop-down menu will appear.
Step 5. Choose the Site Manager… option
It is one of the items in the menu that appeared. The dialog box of the same name will be displayed.
Step 6. Press the New Site button
It is white in color and is located in the lower left corner of the "Site Manager" window. The section of the latter for creating a new link will be displayed.
Step 7. Enter the IP address or URL of the FTP server you want to connect to
Select the "Host:" text field and type in the information shown.
Step 8. Add the communication port to connect to
Type the number 21 into the "Port:" text field.
Step 9. Press the Connect button
It is red in color and located at the bottom of the page. In this way FileZilla will try to establish a connection between the computer and the FTP server indicated.
Step 10. Transfer the files you want from your computer to the server
Drag and drop items from the left pane of the FileZilla interface to the right to upload them to your chosen FTP server. Perform the opposite movement to download from the server to the computer.
Advice
- If you have created and configured an FTP server within your home LAN, enabling port forwarding of port number 20 could help solve some problems related to network communications.
- The procedure for connecting to an FTP server in Ubuntu 17 (or later versions) is slightly different than the one used in previous versions. For this reason, if you haven't already done so, you can consider upgrading your Ubuntu installation to version 17 or later.