How to Install and Configure FTP server on CentOS 8.1
TO INSTALL AND CONFIGURE FTP ON CENTOS 8.1
INTRODUCTION:
The File Transfer Protocol (FTP) is a standard network protocol that is used to transfer computer files between a client and a server through the computer network. FTP is built on a client-server model architecture which is used to separate control and data connections between the client and the server. Let us learn to install and configure the FTP server on CentOS 8.1 through this video.
INSTALLATION PROCESS :
Install ftp daemon service using the yum command
[root@linuxhelp ~]# yum install ftp vsftpd -y
CentOS-8 - AppStream 1.2 kB/s | 4.3 kB 00:03
CentOS-8 - Base 812 B/s | 3.9 kB 00:04
CentOS-8 - Extras 1.3 kB/s | 1.5 kB 00:01
Installing:
ftp x86_64 0.17-78.el8 AppStream 70 k
vsftpd x86_64 3.0.3-31.el8 AppStream 180 k
Install 2 Packages
Total download size: 250 k
Installed size: 456 k
Downloading Packages:
(1/2): ftp-0.17-78.el8.x86_64.rpm 108 kB/s | 70 kB 00:00
(2/2): vsftpd-3.0.3-31.el8.x86_64.rpm 231 kB/s | 180 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : vsftpd-3.0.3-31.el8.x86_64 1/2
……..
……….
Verifying : ftp-0.17-78.el8.x86_64 1/2
Verifying : vsftpd-3.0.3-31.el8.x86_64 2/2
Installed:
ftp-0.17-78.el8.x86_64 vsftpd-3.0.3-31.el8.x86_64
Completed!
Start the vsftpd service
[root@linuxhelp ~]# systemctl start vsftpd
Enable the vsftpd service
[root@linuxhelp ~]# systemctl enable vsftpd
Created symlink /etc/systemd/system/multi-user.target.wants/vsftpd.service → /usr/lib/systemd/system/vsftpd.service.
[root@linuxhelp ~]# systemctl status vsftpd
● vsftpd.service - Vsftpd ftp daemon
Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2020-10-27 16:30:40 IST; 52min ago
Main PID: 7463 (vsftpd)
Tasks: 1 (limit: 11340)
Memory: 552.0K
CGroup: /system.slice/vsftpd.service
└─7463 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
Oct 27 16:30:40 linuxhelp systemd[1]: Starting Vsftpd ftp daemon...
Oct 27 16:30:40 linuxhelp systemd[1]: Started Vsftpd ftp daemon.
[root@linuxhelp ~]# vim /etc/vsftpd/vsftpd.conf
Add a new user to share FTP
[root@linuxhelp ~]# useradd linux
Assign password for the user Linux
[root@linuxhelp ~]# passwd linux
Changing password for user linux.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
Check IP address to the FTP server
[root@linuxhelp ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:0c:29:65:bf:cf brd ff:ff:ff:ff:ff:ff
inet 192.168.7.224/24 brd 192.168.7.255 scope global noprefixroute ens33
valid_lft forever preferred_lft forever
inet6 fe80::a3b2:faea:118e:ad0a/64 scope link noprefixroute
valid_lft forever preferred_lft forever
Login FTP server using IP address
[root@linuxhelp ~]# ftp 192.168.7.224
Connected to 192.168.7.224 (192.168.7.224).
220 (vsFTPd 3.0.3)
Name (192.168.7.224:root): linux
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> exit
221 Goodbye.
Login FTP as a client
[root@linuxhelp ~]# su - linux
[linux@linuxhelp ~]$
Enter IP details of the server
[linux@linuxhelp ~]$ ftp 192.168.7.224
Connected to 192.168.7.224 (192.168.7.224).
220 (vsFTPd 3.0.3)
Enter the user name
Name (192.168.7.224:linux): linux
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
ftp> exit
221 Goodbye.
Now open the browser and enter the FTP server link
Check the user’s Linux home directory
[linux@linuxhelp ~]$ cat /etc/passwd | grep linux
linux:x:1007:1007::/home/linux:/bin/bash
Move to Linux home directory
[linux@linuxhelp ~]$ cd /home/linux
Go to the list file using ls command
[linux@linuxhelp ~]$ ls
Create a directory to share the file
[linux@linuxhelp ~]$ mkdir ac
[linux@linuxhelp ~]$ cd ac
Create a file as file1.txt
[linux@linuxhelp ac]$ touch file1.txt
Open the file using vim command
[linux@linuxhelp ac]$ vim file1.txt
Go back to the directory
[linux@linuxhelp ac]$ cd ../..
Switch-over to the root user
[linux@linuxhelp home]$ su
Password:
List out the user_list file using the cat command
[root@linuxhelp home]# cat /etc/vsftpd/user_list
# vsftpd userlist
# If userlist_deny=NO, only allow users in this file
# If userlist_deny=YES (default), never allow users in this file, and
# do not even prompt for a password.
# Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers
# for users that are denied.
root
bin
daemon
adm
lp
news
uucp
operator
games
nobody
[root@linuxhelp home]# vim /etc/vsftpd/user_list
To view the changes restart the vsftpd service
[root@linuxhelp home]# systemctl restart vsftpd
Enter the following command to view the user list, who is denied to access the FTP.
[root@linuxhelp home]# vim /etc/vsftpd/user_list
Enter the following command to restart the vsftpd service
[root@linuxhelp home]# systemctl restart vsftpd
Let open the vsftpd configuration file
[root@linuxhelp home]# vim /etc/vsftpd/vsftpd.conf
[root@linuxhelp home]# systemctl restart vsftpd
The Process of Installation and Configuration of FTP server on CetOS 8.1 comes to an end.
Port 21 – On this port control connection is established. All commands we send and the FTP server’s responses to those commands will go over the control connection, but any data sent back will go over the data connection.
anonymous_enable=NO