1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How FTP Works With Example

Discussion in 'Web Development' started by lionaneesh, Jan 30, 2011.

  1. lionaneesh

    lionaneesh Active Member

    Joined:
    Mar 21, 2010
    Messages:
    848
    Likes Received:
    224
    Trophy Points:
    43
    Occupation:
    Student
    Location:
    India
    FTP is a abbreviation of File Transfer Protocol , it is the main net work protocol used for downloading/uploading of files...From one host to another using a TCP based network like INTERNET.. FTP works on a principle of client-server model and uses data-connection between client and server..FTP basically runs on port no 21 as default …

    How does FTP works



    A Client makes a TCP connection to the server port 21 . This connection remains open for the duration of the session...and thus is called a control session...

    Then another connection is opened called the data connection...

    The control connection is used for authenticating , command and administrating (I.e commands etc..) exchanged between the client and the server..

    The server responds on the requests with status codes like 200 Ok , 404 error etc etc....

    Code:
      server               client
    +-------+            +-------+
    | comp1 |            | comp2 |
    +-------+            +-------+
                         Client 
    Server               initiates a request
    listens on           and initiates  
    port 21 as default   a TCP connection
    
    The FTP uses mainly 2 file transfer modes

    1. Binary - The binary mode transmits all eight bits per byte thus have much more transfer rate and reduces the chance of transmission error
    2. ASCII - This is the default transfer mode and transmits 7 bits per byte..

    FTP was not designed to be secure …. It is not much secured and has many security weaknesses …

    It is currently vulnerable to :-
    • Sniffers
    • Bounce attacks
    • Spoof attacks
    • Username Protection
    • Port stealing
    • Brute forcing
    But today several programmers have contributed and made it secure by making add-ons.

    Commands



    To connect to a remote machine running a ftp server we can use :-

    Code:
    ftp machinename
    
    Example :

    Code:
    aneesh@aneesh-laptop:~$ ftp ftp.freebsd.org
    
    Connected to ftp.freebsd.org.
    
    220 Welcome to freebsd.isc.org.
    
    Name (ftp.freebsd.org:aneesh): 
    
    For exiting FTP we can use 'bye'
    Example :
    Code:
    ftp> bye
    
    221 Goodbye.
    
    To upload a file from your computer to the server we can use 'put'

    Syntax :-

    Code:
    put (local_file_path)
    
    Example :
    Code:
    ftp> put /home/aneesh/articles/crackme.c 
    
    local: /home/aneesh/articles/crackme.c remote: /home/aneesh/articles/crackme.c
    
    200 PORT command successful. Consider using PASV.
    
    We can also download files from the remote machine to our machine in FTP by using 'get'

    Syntax :-
    Code:
    get (remote file path) (local path [where the file is to be saved])
    
    Most of the basic unix commands works on ftp too..

    Example :
    Code:
    ftp> ls
    
    200 PORT command successful. Consider using PASV.
    
    150 Here comes the directory listing.
    
    drwxrwxr-x    3 110      1002          512 Oct 23  2006 pub
    
    226 Directory send OK.
    
    ftp> cd pub
    
    250 Directory successfully changed.
    
    ftp> ls
    
    200 PORT command successful. Consider using PASV.
    
    150 Here comes the directory listing.
    
    drwxr-xr-x   17 110      1002         1024 Jan 30 15:13 FreeBSD
    
    226 Directory send OK.
    
    ftp> cd FreeBSD
    
    250-If you're looking for one of the FreeBSD releases, please look in the
    
    250-releases/${ARCH}/${RELNAME} directory, where ARCH = "alpha", "amd64",
    
    250-"i386", "ia64", "pc98", or "sparc64" and RELNAME = the release
    
    250-you're interested in, e.g. "7.1-RELEASE" or "8.0-RELEASE".
    
    250 Directory successfully changed.
    
    ftp> cd ../
    
    250 Directory successfully changed.
    
    ftp> pwd
    
    257 "/pub"
    
    ftp> 
    
     
  2. lionaneesh

    lionaneesh Active Member

    Joined:
    Mar 21, 2010
    Messages:
    848
    Likes Received:
    224
    Trophy Points:
    43
    Occupation:
    Student
    Location:
    India
    Thanks for accepting...
    Hope you guyz like iT!!!!!!!
     
  3. cizzlingeast

    cizzlingeast New Member

    Joined:
    Nov 29, 2010
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Home Page:
    thankx for explaining the conecept of FTP.before reading your post ,what i knew about FTP was that it is the abbreviation of File transfer protocol but now i know much more than that.
     
  4. kumarmannu

    kumarmannu Banned

    Joined:
    Feb 2, 2011
    Messages:
    51
    Likes Received:
    0
    Trophy Points:
    0
    When you want to copy files between two computers that are on the same local network, often you can simply "share" a drive or folder, and copy the files the same way you would copy files from one place to another on your own PC.

    What if you want to copy files from one computer to another that is halfway around the world? You would probably use your Internet connection. However, for security reasons, it is very uncommon to share folders over the Internet. File transfers over the Internet use special techniques, of which one of the oldest and most widely-used is FTP. FTP, short for "File Transfer Protocol," can transfer files between any computers that have an Internet connection, and also works between computers using totally different operating systems.

    Transferring files from a client computer to a server computer is called "uploading" and transferring from a server to a client is "downloading".



    Requirements for using FTP

    1. An FTP client like Auto FTP Manager installed on your computer
    2. Certain information about the FTP server you want to connect to:
    a. The FTP server address. This looks a lot like the addresses you type to browse web sites.
    Example : Server address is "ftp.videodesk.net".
    Sometimes the server address will be given as a numeric address, like "64.185.225.87".
    b. A user name and password. Some FTP servers let you connect to them anonymously.
    For anonymous connections, you do not need a user name and password.
     
  5. lionaneesh

    lionaneesh Active Member

    Joined:
    Mar 21, 2010
    Messages:
    848
    Likes Received:
    224
    Trophy Points:
    43
    Occupation:
    Student
    Location:
    India
    Thanks... For your motivating responses
     
  6. shrikrishnatech

    shrikrishnatech New Member

    Joined:
    Nov 19, 2010
    Messages:
    42
    Likes Received:
    4
    Trophy Points:
    0
    Occupation:
    Wordpress theme, Wordpress Theming, WP Themes, Cor
    Home Page:
    thanks for above information
     
  7. jacktom

    jacktom New Member

    Joined:
    Apr 4, 2011
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
    File transfer protocol.
     
  8. Kingston

    Kingston New Member

    Joined:
    Sep 5, 2011
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Software Programmer
    Location:
    Houston,Texas
    Home Page:
    Like awesome demonstration and handling features for FTP.
     

Share This Page