WHAT IS FTP SERVER AND HOW TO CONFIGURE LINUX AS FTP SERVER AND WINDOWS OR LINUX AS CLIENT.

In this article we are going to learn what is ftp server and how to configure ftp in linux.

Ftp is the most used protocol over internet to transfer files. Like most Internet operations, FTP works on a client/ server model. FTP stands for File Transfer Protocol. A user on the remote system has to log in to an account on a server and can then transfer files to and from that account’s directories only.Ftp server is designed from the ground up to be fast, stable, and, most importantly secure.

Follow these steps to configure:

  • First we are gonna install package which is required for ftp server . vsftpad stands for very secure file transfer protocol daemon.
[root@dhcppc6 ~]# yum install vsftpd*
Loaded plugins: rhnplugin, security
Repository 'a' is missing name in configuration, using id
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.i386 0:2.0.5-16.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================================================================================================
 Package                                       Arch                                        Version                                              Repository                                Size
===============================================================================================================================================================================================
Installing:
 vsftpd                                        i386                                        2.0.5-16.el5                                         a                                        140 k
Transaction Summary
===============================================================================================================================================================================================
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)
Total download size: 140 k
Is this ok [y/N]:y
  • It will calculate file size and ask you wanna install it or not . Type y and hit ENTER.
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : vsftpd                                                                                                                                                                  1/1
Installed:
  vsftpd.i386 0:2.0.5-16.el5
Complete!
  • Do you know whats the path of ftp configuration file .
[root@dhcppc6 ~]# vim /etc/vsftpd/vsftpd.conf
  • When you will go inside the file , you will find its a big file . You must be thinking why i’m talking about configuration file . Just to increase your knowledge guys .
# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=YES
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES

# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd/banned_emails
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd/chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=YES
#
# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
# sockets, you must run two copies of vsftpd whith two configuration files.
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES

  • /var/ftp is a path where you should put all your data because ftp is a folder which is gonna show to all your clients. If you don’t find ftp folder in /var , create by mkdir command .
[root@dhcppc6 ~]# cd   /var/ftp
  • I’m gonna create some files to check whether client will get it or not.
[root@dhcppc6 ftp]# touch {a..z}.txt
[root@dhcppc6 ftp]# ls
a.txt  b.txt  c.txt  d.txt  e.txt  f.txt  g.txt  h.txt  i.txt  j.txt  k.txt  l.txt  m.txt  n.txt  o.txt  p.txt  pub  q.txt  r.txt  s.txt  t.txt  u.txt  v.txt  w.txt  x.txt  y.txt  z.txt
  • Now start the ftp service .
[root@dhcppc6 ~]# service vsftpd restart

Shutting down vsftpd:                                      [FAILED]
Starting vsftpd for vsftpd:
  • Check you firewall is on or not .
[root@dhcppc6 ~]# 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
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited
  • If you see word ACCEPT it means firewall is enabled.  Now we have to disable firewall and security enhance settings .
[root@dhcppc6 ~]# iptables -F
[root@dhcppc6 ~]# setenforce 0

NOW COMES THE CLIENT ROLE

  • type ftp and ip address of the server machine . It will ask for user’s name and password .
[root@dhcppc6 ftp]# ftp 192.168.56.101
Connected to 192.168.56.101.
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.56.101:root): deepit
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
  • If you type ? you will find all help in ftp server.If you wanna download file type= get filename    and for upload file type = put filename
ftp> ?

 Commands are:
!               cr              mdir            proxy           send
$               delete          mget            sendport        site
account         debug           mkdir           put             size
append          dir             mls             pwd             status
ascii           disconnect      mode            quit            struct
bell            form            modtime         quote           system
binary          get             mput            recv            sunique
bye             glob            newer           reget           tenex
case            hash            nmap            rstatus         trace
ccc             help            nlist           rhelp           type
cd              idle            ntrans          rename          user
cdup            image           open            reset           umask
chmod           lcd             passive         restart         verbose
clear           ls              private         rmdir           ?
close           macdef          prompt          runique
cprotect        mdelete         protect         safe

 

  • If you want to exit this ftp server .Type quit
ftp> quit
221 Goodbye.

THAT WAS TRANSFER BETWEEN LINUX TO LINUX . IF YOU WANT TO DOWNLOAD FILE IN WINDOWS

  • Get the ip address of the server machine

ip address of linux

  • Now open windows any browser and type   ftp://ipadress of the server machine

ftp server

  • It will connect to the server and you can see all the file that I have created .

ftp server in windows

To stop the ftp service type this command in server machine .

[root@dhcppc6 ftp]# service vsftpd stop
Shutting down vsftpd:                                      [  OK  ]

 

WHAT IS SAMBA SERVER AND HOW TO CONFIGURE IN LINUX

WHAT IS TELNET AND HOW TO CONFIGURE TELNET IN LINUX AS SERVER AND WINDOWS OR ANDROID AS CLIENT.

WHAT IS PYTHON SERVER AND HOW TO CONFIGURE PYTHON AS WEB SERVER IN LINUX.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s