Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Web Development (http://www.go4expert.com/articles/web-development/)
-   -   How FTP Works With Example (http://www.go4expert.com/articles/ftp-example-t24802/)

lionaneesh 30Jan2011 22:09

How FTP Works With Example
 
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>


lionaneesh 31Jan2011 11:56

Re: How FTP Works With Example
 
Thanks for accepting...
Hope you guyz like iT!!!!!!!

cizzlingeast 2Feb2011 13:41

Re: How FTP Works With Example
 
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.

kumarmannu 2Feb2011 16:32

Re: How FTP Works With Example
 
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.

lionaneesh 2Feb2011 20:57

Re: How FTP Works With Example
 
Quote:

Originally Posted by cizzlingeast (Post 78687)
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.

Thanks... For your motivating responses

shrikrishnatech 9Feb2011 12:40

Re: How FTP Works With Example
 
thanks for above information

jacktom 4Apr2011 14:55

Re: How FTP Works With Example
 
File transfer protocol.

Kingston 5Sep2011 16:06

Re: How FTP Works With Example
 
Like awesome demonstration and handling features for FTP.


All times are GMT +5.5. The time now is 12:13.