AMP AMP

How to install and configure vsftpd Server on Oracle Linux 9.2

To Install And Configure Vsftpd Server On Oracle Linux 9.2

Introduction :

• FTP stands for file transfer protocol, used for transferring files from a server to the network. • FTP is built on a client–server model architecture. • The initial client-to-server connection on port 21.

installation steps :

Step 1: Check the OS version by using the below command

[root@linuxhelp ~]# cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="9.2"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="9.2"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Oracle Linux Server 9.2"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:9:2:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://github.com/oracle/oracle-linux"
ORACLE_BUGZILLA_PRODUCT="Oracle Linux 9"
ORACLE_BUGZILLA_PRODUCT_VERSION=9.2
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=9.2

Step 2: Install vsftpd packages by using the below command

[root@linuxhelp ~]# yum install vsftpd
Last metadata expiration check: 0:00:58 ago on Friday 01 December 2023 01:51:25 AM.
Dependencies resolved.
================================================================================
 Package        Architecture   Version              Repository             Size
================================================================================
Installing:
 vsftpd         x86_64         3.0.5-5.el9          ol9_appstream         206 k

Transaction Summary
================================================================================
Install  1 Package

Total download size: 206 k
Installed size: 347 k
Is this ok [y/N]: y
Downloading Packages:
vsftpd-3.0.5-5.el9.x86_64.rpm                   1.0 MB/s | 206 kB     00:00    
--------------------------------------------------------------------------------
Total                                           981 kB/s | 206 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1 
  Installing       : vsftpd-3.0.5-5.el9.x86_64                              1/1 
  Running scriptlet: vsftpd-3.0.5-5.el9.x86_64                              1/1 
  Verifying        : vsftpd-3.0.5-5.el9.x86_64                              1/1 

Installed:
  vsftpd-3.0.5-5.el9.x86_64                                                     

Complete!

Step 3: Start the vsftpd service by using the below command

[root@linuxhelp ~]# systemctl start vsftpd

Step 4: Enable the vsftpd service by using the below command

[root@linuxhelp ~]# systemctl enable vsftpd
Created symlink /etc/systemd/system/multi-user.target.wants/vsftpd.service → /usr/lib/systemd/system/vsftpd.service.

Step 5: Check the status of vsftpd service by using the below command

[root@linuxhelp ~]# systemctl status vsftpd
● vsftpd.service - Vsftpd ftp daemon
    Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; preset: d>
    Active: active (running) since Fri 2023-12-01 01:52:55 IST; 33s ago
  Main PID: 18801 (vsftpd)
     Tasks: 1 (limit: 9176)
    Memory: 1.0M
       CPU: 15ms
    CGroup: /system.slice/vsftpd.service
            └─18801 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf

Dec 01 01:52:55 linuxhelp systemd[1]: Starting Vsftpd ftp daemon...
Dec 01 01:52:55 linuxhelp systemd[1]: Started Vsftpd ftp daemon.

Step 6: Create user for FTP by using the below command

[root@linuxhelp ~]# useradd ftpuser

Step 7: Set password for the ftpuser by using the below command

[root@linuxhelp ~]# passwd ftpuser
Changing password for user ftpuser.
New password: 
BAD PASSWORD: The password is shorter than 8 characters
Retype new password: 
passwd: all authentication tokens updated successfully.

Step 8: Add the ftpuser into userlist file by using the below command

[root@linuxhelp ~]# vim /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
sync
shutdown
halt
mail
news
uucp
operator
games
nobody
ftpuser

step 9: Edit the configuration file ensure the followings lines are uncomment by using the below command

[root@linuxhelp ~]# vim /etc/vsftpd/vsftpd.conf 
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=NO
listen_ipv6=YES
pam_service_name=vsftpd
userlist_enable=YES
userlist_deny=NO

step 10: Restart the vsftpd service by using the below command

[root@linuxhelp ~]# systemctl restart vsftpd

Step 11: create some files in ftpuser home directory by using the below command

root@linuxhelp ~]# touch /home/ftpuser/file{1...5}

Step 12: check whether the client package is installed by using the below command

[root@linuxhelp ~]# rpm -q ftp
package ftp is not installed

step 13: Install the ftp package by using the below command

[root@linuxhelp ~]# yum install ftp
Last metadata expiration check: 0:06:14 ago on Friday 01 December 2023 01:51:25 AM.
Dependencies resolved.
================================================================================
 Package      Architecture    Version              Repository              Size
================================================================================
Installing:
 ftp          x86_64          0.17-89.el9          ol9_appstream           62 k

Transaction Summary
================================================================================
Install  1 Package

Total download size: 62 k
Installed size: 112 k
Is this ok [y/N]: y
Downloading Packages:
ftp-0.17-89.el9.x86_64.rpm                      274 kB/s |  62 kB     00:00    
--------------------------------------------------------------------------------
Total                                           267 kB/s |  62 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1 
  Installing       : ftp-0.17-89.el9.x86_64                                 1/1 
  Running scriptlet: ftp-0.17-89.el9.x86_64                                 1/1 
  Verifying        : ftp-0.17-89.el9.x86_64                                 1/1 

Installed:
  ftp-0.17-89.el9.x86_64                                                        

Complete!

Step 14: Connect to the FTP server by using the below command

[root@linuxhelp ~]# ftp 192.168.6.140
Connected to 192.168.6.140 (192.168.6.140).
220 (vsFTPd 3.0.5)
Name (192.168.6.140:root): ftpuser
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>

Step 15: List the content by using the below command

ftp> ls
227 Entering Passive Mode (192,168,6,140,181,191).
150 Here comes the directory listing.
-rw-r--r--    1 0        0               0 Nov 30 20:29 file1
-rw-r--r--    1 0        0               0 Nov 30 20:29 file2
-rw-r--r--    1 0        0               0 Nov 30 20:29 file3
-rw-r--r--    1 0        0               0 Nov 30 20:29 file4
-rw-r--r--    1 0        0               0 Nov 30 20:29 file5
-rw-r--r--    1 0        0               0 Nov 30 20:26 file{1...5}
226 Directory send OK.

Step 16: Download the contents by using the below command

ftp> get file1
local: file1 remote: file1
227 Entering Passive Mode (192,168,6,140,232,213).
150 Opening BINARY mode data connection for file1 (0 bytes).
226 Transfer complete.

Step 17: Check the downloads by using the below command

ftp> !ls
anaconda-ks.cfg  Documents  file1  Pictures  Templates
Desktop		 Downloads  Music  Public    Videos

step 18: Exit from the FTP

ftp> exit
221 Goodbye

Conclusion :

We have reached the end of this article. In this guide, we have walked you through the steps required to install and configuration the vsftpd server on Oracle Linux 9.2. Your feedback is much welcome.

FAQ
Q
Is FTP use userdatagram protocol ?
A
No, it runs under TCP protocol.
Q
What does SFTP stand for?
A
SFTP stands for SSH file transfer protocol.
Q
Is it possible to access the FTP as an Anonymous user?
A
Yes, if it is enabled we can login.
Q
What is the port used by FTP?
A
port 21 is used by default.
Q
What does FTP stand for?
A
FTP stands for File Transfer Protocol.