Table of Contents
In this article, I will take you through the steps to install and configure FTP Server in Linux. FTP is known as File Transfer Protocol used for transferring files over the network insecurely. Since FTP transferred data is in plain text and not in encrypted form so it is usually recommended to use the secure version of FTP protocol known as VSFTP. It is also known as Very Secure File Transfer Protocol.
Install and Configure FTP Server in Linux
Also Read: 40 Best Examples of find command in Linux
Step 1: Prerequisites
a)You need a running RHEL/CentOS 7/8
System.
b)You should have yum
installed in your system. You can check Top 22 YUM Command Examples in RedHat /CentOS 7 to know more about yum command.
c)You should have sudo
access to run privileges command. You can check How to add User to Sudoers to know more about providing sudo
access to the User.
Step 2: Update Your System
Sometimes it might happen that installation of new packages requires few of the dependencies to be updated hence you need to first update your system packages to the latest version before proceeding with the steps to configure FTP Server(vsftpd). This can be performed by using simple yum update -y
command as shown below. This command might take sometime to update all the packages depends on the last time you have updated your system. Since in this case there is only one file so it won't take much time to complete the update.
[root@localhost ~]# yum update -y Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.piconets.webwerks.in * epel: mirror.xeonbd.com * extras: mirrors.piconets.webwerks.in * updates: mirrors.piconets.webwerks.in Resolving Dependencies --> Running transaction check ---> Package microcode_ctl.x86_64 2:2.1-61.el7 will be updated ---> Package microcode_ctl.x86_64 2:2.1-61.6.el7_8 will be an update --> Finished Dependency Resolution Dependencies Resolved ======================================================================================================================================================================== Package Arch Version Repository Size ======================================================================================================================================================================== Updating: microcode_ctl x86_64 2:2.1-61.6.el7_8 updates 2.6 M Transaction Summary ======================================================================================================================================================================== Upgrade 1 Package Total download size: 2.6 M Downloading packages: Delta RPMs disabled because /usr/bin/applydeltarpm not installed. microcode_ctl-2.1-61.6.el7_8.x86_64.rpm | 2.6 MB 00:00:01 Running transaction check Running transaction test Transaction test succeeded Running transaction Updating : 2:microcode_ctl-2.1-61.6.el7_8.x86_64 1/2 Cleanup : 2:microcode_ctl-2.1-61.el7.x86_64 2/2 Verifying : 2:microcode_ctl-2.1-61.6.el7_8.x86_64 1/2 Verifying : 2:microcode_ctl-2.1-61.el7.x86_64 2/2 Updated: microcode_ctl.x86_64 2:2.1-61.6.el7_8 Complete!
Step 3: Install FTP(vsftpd) Package
After updating your system successfully you can install vsftpd package using yum install -y vsftpd
command as shown below. This command will check and install all the dependencies required by vsftpd package. Installation size of the package is quiet small and should not take much time to complete the installation.
[root@localhost ~]# yum install -y vsftpd Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile epel/x86_64/metalink | 7.6 kB 00:00:00 * base: mirrors.piconets.webwerks.in * epel: mirror.xeonbd.com * extras: mirrors.piconets.webwerks.in * updates: mirrors.piconets.webwerks.in base | 3.6 kB 00:00:00 extras | 2.9 kB 00:00:00 updates | 2.9 kB 00:00:00 Resolving Dependencies --> Running transaction check ---> Package vsftpd.x86_64 0:3.0.2-27.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ======================================================================================================================================================================== Package Arch Version Repository Size ======================================================================================================================================================================== Installing: vsftpd x86_64 3.0.2-27.el7 base 172 k Transaction Summary ======================================================================================================================================================================== Install 1 Package Total download size: 172 k Installed size: 353 k Downloading packages: vsftpd-3.0.2-27.el7.x86_64.rpm | 172 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : vsftpd-3.0.2-27.el7.x86_64 1/1 Verifying : vsftpd-3.0.2-27.el7.x86_64 1/1 Installed: vsftpd.x86_64 0:3.0.2-27.el7 Complete!
Step 4: Enable FTP(vsftpd) Server
If you check the vsftpd status immediately after installing the package then it will show in disabled state as you can see below. So you need to first enable the service by using systemctl enable vsftpd
command and then again if you check the status using systemctl status vsftpd
command it will show in enabled state.
[root@localhost ~]# systemctl status vsftpd ● vsftpd.service - Vsftpd ftp daemon Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; disabled; vendor preset: disabled) Active: inactive (dead) [root@localhost ~]# systemctl enable vsftpd Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service. [root@localhost ~]# systemctl status vsftpd ● vsftpd.service - Vsftpd ftp daemon Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled) Active: inactive (dead)
Step 5: Configure FTP Server
To configure FTP Server you need to perform below changes in the /etc/vsftpd/vsftpd.conf
. This is the basic setting you can do to configure vsftpd server. You need to change anonymous_enable to YES if it is not already changed.
[root@localhost ~]# vi /etc/vsftpd/vsftpd.conf anonymous_enable=YES local_enable=YES write_enable=YES
Step 6: Start FTP(vsftpd) Server
After saving the configuration file you can start the vsftpd service by using systemctl start vsftpd
command as shown below. If all the saved configuration is correct and then it will start successfully without any error and you can confirm the same by running systemctl status vsftpd
command as specified in the below output.
[root@localhost ~]# systemctl start vsftpd [root@localhost ~]# systemctl status vsftpd ● vsftpd.service - Vsftpd ftp daemon Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled) Active: active (running) since Sat 2020-06-13 10:31:19 EDT; 2s ago Process: 19048 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=0/SUCCESS) Main PID: 19049 (vsftpd) Tasks: 1 CGroup: /system.slice/vsftpd.service └─19049 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf Jun 13 10:31:19 localhost.localdomain systemd[1]: Starting Vsftpd ftp daemon... Jun 13 10:31:19 localhost.localdomain systemd[1]: Started Vsftpd ftp daemon.
Step 7: Install FTP(lftp) Client
If you want to test the FTP Server Connection then you need to install a FTP Client Package using yum install lftp -y
command as shown below.
[root@localhost ~]# yum install lftp -y Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.piconets.webwerks.in * epel: mirror.xeonbd.com * extras: mirrors.piconets.webwerks.in * updates: mirrors.piconets.webwerks.in Resolving Dependencies --> Running transaction check ---> Package lftp.x86_64 0:4.4.8-12.el7_8.1 will be installed --> Finished Dependency Resolution Dependencies Resolved ======================================================================================================================================================================== Package Arch Version Repository Size ======================================================================================================================================================================== Installing: lftp x86_64 4.4.8-12.el7_8.1 updates 752 k Transaction Summary ======================================================================================================================================================================== Install 1 Package Total download size: 752 k Installed size: 2.4 M Downloading packages: lftp-4.4.8-12.el7_8.1.x86_64.rpm | 752 kB 00:00:01 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : lftp-4.4.8-12.el7_8.1.x86_64 1/1 Verifying : lftp-4.4.8-12.el7_8.1.x86_64 1/1 Installed: lftp.x86_64 0:4.4.8-12.el7_8.1 Complete!
Step 8: Test FTP Server Connection
Finally, you can test the FTP Server Connection by connecting it through FTP Client using lftp localhost
command as you can see below.
[root@localhost ~]# lftp localhost lftp localhost:~> ls drwxr-xr-x 2 0 0 6 Apr 01 04:55 pub
Popular Recommendations:-
Install and Configure FTP Server in Ubuntu
How to Enable or Disable SELinux Temporarily or Permanently on RedHat/CentOS 7/8
10 Popular Examples of sudo command in Linux(RedHat/CentOS 7/8)
9 useful w command in Linux with Examples
12 Most Popular rm command in Linux with Examples
Create a Self Signed Certificate using OpenSSL
Thank youuuuuu