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 …
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....
The FTP uses mainly 2 file transfer modes
FTP was not designed to be secure …. It is not much secured and has many security weaknesses …
It is currently vulnerable to :-
To connect to a remote machine running a ftp server we can use :-
Example :
For exiting FTP we can use 'bye'
Example :
To upload a file from your computer to the server we can use 'put'
Syntax :-
Example :
We can also download files from the remote machine to our machine in FTP by using 'get'
Syntax :-
Most of the basic unix commands works on ftp too..
Example :
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
- Binary - The binary mode transmits all eight bits per byte thus have much more transfer rate and reduces the chance of transmission error
- 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
Commands
To connect to a remote machine running a ftp server we can use :-
Code:
ftp machinename
Code:
aneesh@aneesh-laptop:~$ ftp ftp.freebsd.org Connected to ftp.freebsd.org. 220 Welcome to freebsd.isc.org. Name (ftp.freebsd.org:aneesh):
Example :
Code:
ftp> bye 221 Goodbye.
Syntax :-
Code:
put (local_file_path)
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.
Syntax :-
Code:
get (remote file path) (local path [where the file is to be saved])
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>


