FTP (File Transfer Protocol) is used to transfer computer files between client and servers on a computer network. FTP users can authenticate themselves with a username/password, but FTP users can also connect anonymously, if the FTP server is configured to allow it.
In this lab, we will install and configure Anonymous FTP Server on CentOS 8.
Here, configurations are performed through Linux CLI (Command Line Interface). Therefore, we strongly recommend you should read The Linux Command Line, 2nd Edition by William Shotts, to develop a strong understanding of Linux CLI.
This Article Provides:
Environment Specification:
We are using a CentOS 8 minimal virtual machine with following specification.
- CPU - 3.4 Ghz (2 cores)
- Memory - 2 GB
- Storage - 20 GB
- Operating System - CentOS 8.0
- Hostname – ftp-server.recipes.com
- IP Address - 192.168.116.206 /24
Installing vsftpd on CentOS 8:
We are installing vsftpd package to configure a FTP services on our CentOS 8 server.
[root@ftp-server ~]# dnf install -y vsftpd
CentOS-8 - Extras 937 B/s | 1.5 kB 00:01
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing:
vsftpd x86_64 3.0.3-28.el8 AppStream 180 k
Transaction Summary
================================================================================
Install 1 Package
Total download size: 180 k
Installed size: 359 k
Downloading Packages:
vsftpd-3.0.3-28.el8.x86_64.rpm 322 kB/s | 180 kB 00:00
--------------------------------------------------------------------------------
Total 152 kB/s | 180 kB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : vsftpd-3.0.3-28.el8.x86_64 1/1
Running scriptlet: vsftpd-3.0.3-28.el8.x86_64 1/1
Verifying : vsftpd-3.0.3-28.el8.x86_64 1/1
Installed:
vsftpd-3.0.3-28.el8.x86_64
Complete!
Allow anonymous access to FTP server by editing vsftpd configuration file.
[root@ftp-server ~]# vi /etc/vsftpd/vsftpd.conf
Find and set following directive in this file.
anonymous_enable=YES
Enable and start FTP service.
[root@ftp-server ~]# systemctl enable --now vsftpd.service
Created symlink /etc/systemd/system/multi-user.target.wants/vsftpd.service รข /usr/lib/systemd/system/vsftpd.service.
Connecting with CentOS 8 based Anonymous FTP Server:
To connect to an FTP server, we need a FTP client.
There are many free FTP clients available on the Internet and in CentOS 8 yum repository.
We are installing lftp (A sophisticated FTP Client) to connect with our FTP server.
[root@ftp-client ~]# dnf install -y lftp
Last metadata expiration check: 0:24:42 ago on Thu 13 Feb 2020 07:04:11 PM PKT.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing:
lftp x86_64 4.8.4-1.el8 AppStream 889 k
Transaction Summary
================================================================================
Install 1 Package
Total download size: 889 k
Installed size: 3.2 M
Downloading Packages:
lftp-4.8.4-1.el8.x86_64.rpm 621 kB/s | 889 kB 00:01
--------------------------------------------------------------------------------
Total 467 kB/s | 889 kB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : lftp-4.8.4-1.el8.x86_64 1/1
Running scriptlet: lftp-4.8.4-1.el8.x86_64 1/1
Verifying : lftp-4.8.4-1.el8.x86_64 1/1
Installed:
lftp-4.8.4-1.el8.x86_64
Complete!
Connect with FTP Server anonymously using lftp command.
[root@ftp-client ~]# lftp ftp-server
lftp ftp-server:~> ls
drwxr-xr-x 2 0 0 24 Feb 10 15:54 pub
Download a file from FTP Server.
lftp ftp-server:/> cd pub
lftp ftp-server:/pub> get cacert.p12
12354 bytes transferred
Exit from lftp client.
lftp ftp-server:/pub> exit
We have successfully installed and configured Anonymous FTP Server on CentOS 8.
No comments:
Post a comment