Whenever we Download or Upload a Files from any machine the FTP Protocols comes in to service.FTP stand for File Transfer Protocol.It’s names say everything about self. Whether you Download a File From Server or Upload a File up on server FTP comes in use.
DOWNLOADING: When data get transferred from Server to Client the process is known as Downloading.
UPLOADING: When data transferred from client to Server the Process is known as Uploading.
So whether you transfer file from server to client or client to server ,in both case the data get transferred and whenever or wherever the data get transferred from one place to another the FTP protocol comes in to use.
So today in This tutorial we will learn how to Configure this FTP service on Redhat enterprise Linux and also learn how to use it.I use very simple and short steps to mention the configuration of FTP Server configuration and FTP Client Configuration along with its command and usage.
If you are interested in Linux You can Also Learn:
DHCP Server configuration in Linux
DNS server configuration in Linux
Apache Web server configuration in Linux
Apache web server security in Linux
Step1: Install FTP Service Package using yum.
[root@localhost ~]# yum install vsftpd* -y
Step2: Restart the FTP Service and verify status
[root@localhost ~]# service vsftpd restart Shutting down vsftpd: [FAILED] Starting vsftpd for vsftpd: [ OK ] [root@localhost ~]#
Run below command so that FTP service keep running even after System Reboot.
[root@localhost ~]# chkconfig vsftpd on
Cross Check whether FTP Service is Running or Not with Below Command.
[root@localhost ~]# service vsftpd status vsftpd (pid 2705) is running... [root@localhost ~]#
Step3:Home Directory For FTP user is /var/ftp
By default FTP service share /var/ftp/ Folder with his Anonymous users.
So at this Point of Time any Thing kept inside /var/ftp Folder is sharable with all Anonymous Users even without any password or any other Authentication.
the Client Machine have to only type the server ip address or domain name in his/her Browser. Like ftp://192.168.0.107
and That’s ALL!
You can see below Image how to access Ftp service in Windows.
(here I assume that you have Disables Your Firewall and Selinux is not in enforcing Mode)
Step5:So what if Your Selinux is Enforcing Mode and You want to Disable it.
Just check your Selinux Status using below command.
[root@localhost ~]# getenforce Enforcing
If you want to set it to permissive Mode just type below command.
[root@localhost ~]#setenforce 0 [root@localhost ~]# getenforce Permissive
Step6:Now what if your Firewall is Enabled and FTP service is not allowed in Firewall.
Then either you have to disable your firewall or you have to set your firewall to allow ftp service. Have a look on Both side step wise.
Condition 1:When your Firewall is enabled and you don’t want to disable it and just want to allow your ftp service.Then just do as i have mentioned below.
[root@localhost ~]#setup
Now go to Firewall Configuration:
Now Click on Customize option to go inside Firwall configuration Mode
Now Click on FTP and then click on ok Then exit.
after saving and exit run the below commands.
[root@localhost ~]# service iptables save Saving firewall rules to /etc/sysconfig/iptables: [ OK ]
Now Cross check the Firewall Status:
[root@localhost ~]# service iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 RH-Firewall-1-INPUT all -- 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 RH-Firewall-1-INPUT all -- 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
Chain RH-Firewall-1-INPUT (2 references)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 255
3 ACCEPT esp -- 0.0.0.0/0 0.0.0.0/0
4 ACCEPT ah -- 0.0.0.0/0 0.0.0.0/0
5 ACCEPT udp -- 0.0.0.0/0 224.0.0.251 udp dpt:5353
6 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:631
7 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:631
8 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
9 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
10 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:21
11 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
[root@localhost ~]#
Condition2:If the Firewall is Enabled and You don’t want to drill your brain in firewall setup or any kind of customization then just Disabled or FLUSH the Firewall rules.
To see Firewall Rules.
[root@localhost ~]# iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination RH-Firewall-1-INPUT all -- anywhere anywhere Chain FORWARD (policy ACCEPT) target prot opt source destination RH-Firewall-1-INPUT all -- anywhere anywhere Chain OUTPUT (policy ACCEPT) target prot opt source destination Chain RH-Firewall-1-INPUT (2 references) target prot opt source destination ACCEPT all -- anywhere anywhere ACCEPT icmp -- anywhere anywhere icmp any ACCEPT esp -- anywhere anywhere ACCEPT ah -- anywhere anywhere ACCEPT udp -- anywhere 224.0.0.251 udp dpt:mdns ACCEPT udp -- anywhere anywhere udp dpt:ipp ACCEPT tcp -- anywhere anywhere tcp dpt:ipp ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ftp REJECT all -- anywhere anywhere reject-with icmp-host-prohibited You have new mail in /var/spool/mail/root [root@localhost ~]#
Now Flush all these Firewall Rules and Cross check Firewall status using below commands
[root@localhost ~]# iptables -F
Above command wil Flush Firewall Rules.
And Belwo command will show Firewall status.
[root@localhost ~]# service iptables status Table: filter Chain INPUT (policy ACCEPT) num target prot opt source destination Chain FORWARD (policy ACCEPT) num target prot opt source destination Chain OUTPUT (policy ACCEPT) num target prot opt source destination Chain RH-Firewall-1-INPUT (0 references) num target prot opt source destination [root@localhost ~]#
Step7:How to login to FTP From a Linux terminal.
[root@localhost ~]# ftp 192.168.0.107 Connected to 192.168.0.107. 220 (vsFTPd 2.0.5) 530 Please login with USER and PASS. 530 Please login with USER and PASS. KERBEROS_V4 rejected as an authentication type Name (192.168.0.107:root): ftp 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp>
Step8:Linux Basic Ftp Commands:
mget: To Download files
mput: To upload Files
mdel: to Delete Files
ls:to see files on FTP server
!ls :To see files on FTP client Machine.
You can see an Example in below image.
Step9: Configuration file For FTP SERVER.
/etc/vsftpd/vsftpd.conf is main configuration file for FTP server.We will study in detail about ftp configuration file in Next part of FTP server tutorial.
[root@localhost ~]# vim /etc/vsftpd/vsftpd.conf
Step10:How to stop and Check FTP Service
[root@localhost ~]# service vsftpd stop Shutting down vsftpd: [ OK ] [root@localhost ~]# service vsftpd status vsftpd is stopped [root@localhost ~]#
its a very helpful information for me sir please publish part 2
LikeLike