What are the package, daemon, port number, configuration file for FTP server?

First, install the package and check the package is installed or not.

Package vsftpd-2.2.2-11.el6.x86_64.rpm,
ftp-0.17-53.el6.x86_64.rpm
Daemon vsftpd
Port number 21 for TCP,
20 for UDP
Configuration files /etc/vsftpd/vsftpd.conf
/etc/vsftpd/user_list
/etc/vsftpd/ftpuser /etc/pam.d/vsftpd
Home directory /var/ftp

 

(This directory will be created after installing the package only)

 

How to configure FTP server in Redhat Linux step by step?

• First, install the package and check the package is installed or not.

[root@sys2 ~]# yum install vsftpd
Loaded plugins: product-id, refresh-package kit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:2.2.2-11.el6 will be installed
--> Finished Dependency Resolution Dependencies Resolved
==========================================
Package                           Arch
Version                             Repository
Size
==========================================
Installing:
vsftpd                               x86_64
2.2.2-11.el6                      ithonors-repo
151 k
Transaction Summary
===========================================
Install                                1 Package(s)
Total download size: 151 k
Installed size: 331 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : vsftpd-2.2.2-11.el6.x86_64 1/1
Verifying : vsftpd-2.2.2-11.el6.x86_64 1/1
Installed:
vsftpd.x86_64           0:2.2.2-11.el6
Complete!

 

Check the package is installed or not.

[root@sys2 ~]# rpm -qa vsftpd
vsftpd-2.2.2-11.el6.x86_64

 

From the above output, we can confirm that the package is installed.

  • FTP Server is by default configured to listen on port 21.
  • Port 21 must be opened if you have configured the firewall. The configuration of a firewall for an FTP server is a relatively simple process.

 

The configuration of firewall is as follows :

Remember: In an organization, there could be a separate team for handling the requests of the firewall. If yes, then we can raise a change or work order accordingly and get the work done with them.

Knowing the steps are always helpful.

#iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
[root@sys2 ~]# iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
[root@sys2 ~]# iptables -L
Chain INPUT (policy ACCEPT)
target prot         opt   source              destination
ACCEPT            all --   anywhere       anywhere          state RELATED,ESTABLISHED
ACCEPT            icmp --anywhere      anywhere
ACCEPT            all --   anywhere       anywhere
ACCEPT            tcp -- anywhere        anywhere           state NEW tcp dpt:ssh
REJECT            all --  anywhere         anywhere           reject-with icmp-host-prohibited
ACCEPT            tcp -- anywhere        anywhere           state NEW tcp dpt:ftp
Chain FORWARD (policy ACCEPT)
target prot         opt    source              destination
REJECT            all -- anywhere          anywhere            reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
target prot   opt source   destination

 

• Go to the /var/ftp/pub directory and create the files which are going to be transmitted to the remote machine.

[root@sys2 ~]# cd /var/ftp
[root@sys2 ftp]# ls
pub
[root@sys2 ftp]# cd pub
[root@sys2 pub]# touch   ithonours1   ithonours2   ithonours3
[root@sys2 pub]# ls
ithonours1   ithonours2   ithonours3

 

The above highlighted three files are going to be transmitted to the remote machine.

• Restart the service

#service vsftpd restsrt
[root@sys2 ~]# service vsftpd restart
Shutting down vsftpd:                                          [ OK ]
Starting vsftpd for vsftpd:                                    [ OK ]

 

• Make the service enable after rebooting the system also

[root@sys2 ~]# chkconfig --list vsftpd
vsftpd       0:off        1:off     2:on      3:on      4:on    5:on     6:off

 

The numbers in the above output indicates the runlevels

• Check the ipaddress of the ftp server.

[root@sys2 ~]# ifconfig –a
eth2        Link encap:Ethernet HWaddr    00:0C:29:F2:03:74
inet addr:192.168.1.5       Bcast:192.168.1.255      Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fef2:374/64     Scope:Link
UP BROADCAST RUNNING MULTICAST   MTU:1500   Metric:1
RX packets:1934    errors:0    dropped:0    overruns:0    frame:0
TX packets:8       errors:0    dropped:0    overruns:0    carrier:0                            collisions:0             txqueuelen:1000
RX bytes:166186 (162.2 KiB)     TX bytes:1182 (1.1 KiB)

 

The above highlighted part in the output is the server ip address

• Turn off the selinux and iptables firewalls.

 

Topics Summary