Introduction to FTP Server in Linux
In this article, we will learn about FTP Servers in Linux, Usage, and Installation in brief. To simply state, FTP is an Internet Protocol used for Transmitting Files over the Internet/Network from Source Computer to Destination. FTP stands for “File Transfer Protocol”
Basically, the FTP server uses a Client-Server Architecture to transfer files. FTP Server is a Software Application, that uses the File Transfer Protocol to share files over the Internet between Client and Host machine. Here we have two machines, the end-user, which is a local host machine and a Destination, which is a remote host. Both machines have the same FTP Server Application Software running.
FTP server Type Files Transmission has many of its Advantages like
- It allows you to transfer multiple amounts of Files and Directories/Folders.
- In the case of Interrupted Connection, your file will not be lost, instead, you’ll be able to resume the transfer where it dropped.
- FTP is faster than HTTP
- And finally, you can schedule a File transfer.
With above-mentioned Advantages, FTP does have a few Disadvantages:
- Basically, transferring multiple files at an instance, simultaneously, will result in adding latter files in a queue and not uploading every file at the same moment.
- Few security points like upon using a simple Brute Force Attack, any outsider can gain access.
- Your login credentials like Username and Passwords are sent in clear text format.
- With easy access, a newbie, inexperienced person can (accidentally) wipe out the FTP or any other major action easily.
The Two Types of Connections
The connection is a simple relationship acquired between Two points. In FTP, we have two basic connections, to begin with, Control Connection and a Data Connection.
- Control Connection: This is an Initial Connection which is established soon as Login Credentials are sent and one of the TCP Port 20 or 21 is opened.
- Data Connection: This is a latter connection established for a specific purpose of transferring data.
Along with Two Types of Connections, FTP works in Two different modes, Active and Passive FTP. These modes depend on the, who initiates the Data Connection, Client or Server.
In Active Mode: The Server Initiates the Data Connection, and the Client listens to a random port for incoming data connections from the server.
4.5 (3,173 ratings)
In Passive Mode: The Client initiates the Data connection by sending the data, and the server listens.
Moving further, we will learn how to install the FTP Server Software Application on a Computer machine with a Linux Operating System. Here, we will use “VSFTPD”, which is an FTP server for Unix-like systems, it is Licensed under GNU General Public License and supports IPv6 and SSL. It also supports FTPS, which is the extended community of FTP with security. VSFTPD stands for “Very Secure File Transfer Protocol Daemon” VSFTPD is a default FTP Server for Unix Based Operating Systems like Linux Ubuntu, Fedora, CentOS, and RHEL distributions.
Let’s begin with the VSFTPD Installation.
Recommended: Before beginning with the installation process for any tool/software application in any Unix based system, it is recommended to fire an update command.
Further Process: To simple explain, we will now execute a simple “apt-get install” query to install the VSFTPD application, then we will move on editing the .conf file with configuration settings and then finally we’ll start the VSFTPD server.
Steps to Install the VSFTPD Application
Step 1: Installation
Based on the Type of Linux Distribution you are using, the command for installation might vary.
For Linux Ubuntu/Debian based systems, you can install VSFTPD as simple as executing the following command:
sudo apt-get install vsftpd
For Red Hat/CentOS: execute the following command
yum install vsftpd
Tip: In case you had an error regarding unmet dependencies with Ubuntu, just fire a simple “sudo apt-get –f install” command, which will solve the problem, and then proceed with the installation.
Step 2: Configuration
From here we will configure the file for Ubuntu. The configuration file lies in /etc/vsftpd/ folder.
*Note: The configuration file, changes might be in form of adding a line, modifying an existing one or uncommenting a line.
But before editing the default changes we will make a copy of the original. Run the below command.
Sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.copy
Now that we have a copy of the original, let’s make some configuration changes. Open the configuration file by executing the below command.
Sudo nano /etc/vsftpd.conf
|anonymous_enable=NO||Disable the default anonymous login|
|local_enable=YES||Allow local Logins.|
|write_enable=YES||Permission to allow FTP commands|
|chroot_local_user=YES||Allow local users to access files.|
|userlist_enable=YES0||Will load the usernames|
|userlist_file=/etc/vsftpd.userlist||Stores the usernames|
|tcp_wrappers=YES||Turn on TCP wrappers|
Above are the changes, that shall be made in vsftp.conf file. Other than the above-listed changes, there might change needed according to your system.
Now, save the changes and close the file. Once, changes are saved and the file is closed, we will restart the VSFTPD services in order for the changes to take effect. Execute the following command:
systemctl restart vsftpd
Until this point, we have successfully Installed the VSFTPD, made the required changes in the configuration file and have pushed the restart button.
Now let’s check out the basic commands for using FTP.
- One of the basic and most useful commands is: “?/help”, which is print Basic Information, to begin with.
- open: connects to a remote server.
- get: this command simply retrieves the files from server and store in a local machine.
- dir: print the list of content in the directory.
*Below image displays the output of the help query
- close/disconnect: both are used to terminate the FTP session.
- exit terminates the FTP session and exits.
- ls: prints the list of content in the directory over the server.
- delete: deletes a file.
- mdelete: deletes multiple files.
Above mentioned are the basic FTP commands for Linux, if you need more commands, use the “help” command to have the list.
FTP is the simplest way to transfer files over a network but has its own security flaws, FTP commands are similar to Unix Terminal commands, FTP comes with its pros and cons, operates on two basic connections. To conclude, we have understood, what an FTP server is, learned its Advantages and Disadvantages, the stepwise procedure for its Installation on a Linux Ubuntu and we tried a few of its basic commands.
This has been a guide to FTP Server in Linux. Here we discuss an introduction to FTP Server in Linux, two types of connections, and steps to install the VSFTPD application. You can also go through our given articles to learn more-