Monday, January 28, 2008

FTP and Anonymous FTP

What is FTP?

FTP (File Transfer Protocol) allows a person to transfer files
between two computers, generally connected via the Internet. If
your system has FTP and is connected to the Internet, you can
access very large amounts of files available on a great number of
computersystems. If you are on Bitnet or a UUCP host, you should
look for servers that work through electronic mail (e-mail). A
good source of information on archives in general, is the Usenet
newsgroup comp.archives. When using FTP, you use a program, called
a 'client' to connect to a machine that holds the files, a 'server'.

What is Anonymous FTP?

Many computersystems throughout the Internet offer files through
anonymous FTP. This means that you can access a machine
without having to have an account on that machine (i.e. you don't
have to be an official user of the system). These anonymous FTP
servers contain software, documents of various sorts, files
for configuring networks, graphic images, songlyrics and all sorts
of other information. Archives for electronic mailing lists are
often stored on and are available through anonymous FTP. An
enormous amount of information is stored on these machines and is
ready for anyone who's seeking it.

Note that all this is subject to change, it is a privilege
and the person responsible for the machine can shut it down
at any time without you being able to do anything about it.

Commands

All the normal FTP commands may be used to retrieve files. Some
FTP commands are the same on different computers, but others
are not. Also, some of the ftp sites offer custom commands like
getting a directory with one command, 'regetting' a file or searching
of directories. Read the relevant README files on the site itself
for the 'special access features'.
Usually, FTP will list the commands if you type 'help' or type a
question mark (?). Also, your computer's help command may have
information about FTP. Try 'man ftp', 'man ftpd', 'help ftp',
'ftp /?', 'ftp -?' or 'ftp /h' (all these to be typed without
quotes).

Some useful commands available on most systems include:

ascii Switch to ascii mode. Ascii mode is the default mode
and used for transferring text files
binary Switch to binary mode. For transferring binary files
like .ZIP files, .Z files and the like
cd Change the directory on the remote computer
dir List the files in the current directory on the remote
computer.
ls Same as 'dir', but shows less information sometimes.
get Copy a file from the remote computer to yours
hash Puts a '#' on the screen for every of bytes
transferred. is 1024 in some cases, 2048 in others
but is between 1024 and 4096 in most cases.
Check the ftp 'help' function for more info on the number for
your clientprogram.
help Gives help on the use of commands within the ftp program
lcd Change the directory on your computer (the 'l' is for local)
lpwd Shows the present working directory (pwd) on your
computer (the 'l' is for local). Note: this may not
work on all machines. On a Unix machine, try !pwd
if lwpd doesn't work.
mget Copy multiple files from the remote computer to yours
pwd Shows the present working directory (pwd) on the
remote computer

Procedure

Anonymous FTP is a facility offered by many machines on the
Internet. This permits you to log in with the user name 'anonymous'
or the user name 'ftp'. When prompted for a password, type your e-mail
address -- it's not necessary, but it's a courtesy for those
sites that like to know who is making use of their facility. Be
courteous. Some sites require a valid e-mail address, others don't.

You can then look around and retrieve files. (Most anonymous ftp
sites do not permit people to store files). Note that when you
retrieve files, you have to know where the files are going to
end up on your machine. This is where the 'lpwd' command comes
in handy. Also note that when you have transferred a file that
you want to use on your PC, but you run ftp from a Unix machine
(or a similar mainframe or network machine), you will have to ftp
the file from the Unix machine to your PC first (this is assuming
that you can't ftp to outside your company or campus from your PC,
otherwise you could have gotten the file directly to the PC).
This may sound silly, but sometimes people don't know where their
files are stored or a system administrator decides to give ftp
access to only a few systems.

Typically, a directory called 'pub' is where the interesting
things are stored. Some sites will have a file with a name
like ls-lR, that contains a complete list of the files on
that site. Otherwise, you can type ls -lR and get such a listing
-- for some sites, this can take a LONG time (the size of the
resulting file can be anywhere between approximately 2000 bytes
and 25Mb).

When retrieving non-text files, you must use binary mode,
otherwise the file gets messed up. To do this, use the
'binary' command. (It's safe to set this for text files, but
the result might look a bit different from an ASCII transfer)
If the site at the other end is non-Unix, you may need to
use some other mode -- see the documents or README files
for that site and for FTP (common other modes, are LZ for
VAX Multinet servers, tenex or image for some others).

The simplest way to initiate FTP would be to give the command
'ftp '. The is the remote
system you are connecting to, either a name like garbo.uwasa.fi,
if you have an entry in /etc/hosts or are accessing a Domain
Name Server or the Internet address 193.166.120.5 for Garbo. If
that last sentence doesn't seem to make sense just try: ftp
garbo.uwasa.fi or ftp 193.166.120.5 and look what happens.
After a short wait, you will be prompted for your username. If
you do not have an account on the remote system, some systems
allow you to use 'anonymous'. This gives you a restricted
access path (meaning that you can only run certain commands
like 'dir' or 'ls' and are allowed only access to certain
directories like 'pub').

You would then be prompted for a password. Some systems will
tell you to send your real identity as the password. What you
type doesn't matter in most cases, but it is suggested to give
your e-mail address. This as a courtesy to the archive maintainers,
who would like to know who's using their system. Other systems
need a password of 'guest', or something similar.
DO NOT TYPE A PASSWORD THAT YOU USE ON YOUR OWN SYSTEM!

After that, you should receive the FTP prompt ( usually ftp> )
and have access. You can get a directory of files by giving a
'dir' command. If the remote system is Unix-based and dir does
not work, try 'ls -l' for an MS-DOS like output.
On Garbo, there is a file available in the default anonymous ftp
directory that explains what Garbo is and where files are located.
Look for 00-index.txt or README files or some similar name.

Command
----------
ftp test.com

username : anonymous
password : guest or your email id

No comments: