Friday, February 1, 2008

FTP HOWTO

FTP (File Transfer Protocol) is a client/server tcp protocol that allows a
user to transfer files to and from a remote network site.

An FTP site is a computer that is running FTP server software.

An FTP client is the userland application that provides access to FTP
servers. There are many FTP clients available. Some are graphical, some are
text-based.

The standard ftp program is the original ftp client. It comes standard with
most Linux distributions. It first appeared in 4.2BSD, which was developed
by the University of California, Berkeley.

It's easy to use ftp. Let's say you want to connect to the anonymous ftp
site metalab.unc.edu, to download the latest Linux kernel source.

At the command line, type:

$ ftp metalab.unc.edu

The ftp program will attempt to connect to metalab.unc.edu. When it
succeeds, it will ask you for a login:

220 helios.oit.unc.edu FTP server (Version wu-2.6.0(2) Wed Nov 17 14:44:12
EST 1999) ready.
Name (metalab.unc.edu:mkb):

We log in as anonymous or ftp, to get to the public archive.

331 Guest login ok, send your complete e-mail address as password.
Password:

We now enter a complete e-mail address as the password. After ftp has a
successful login, the following information is given to us:

Remote system type is UNIX.
Using binary mode to transfer files.
ftp>

Note that the file transfer type is binary. Binary mode transfers the files,
bit by bit, as they are on the FTP server. Ascii mode, however, will download
the text directly. You can type ascii or binary to switch between the types.

You want to download the kernel source, so you leave the file transfer type
at binary.

You do an ls to see a list of the files:

ftp> ls

200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
total 33590
-r--r--r-- 1 root other 34348506 Dec 03 03:53 IAFA-LISTINGS
lrwxrwxrwx 1 root other 7 Jul 15 1997 README -> WELCOME
-rw-r--r-- 1 root other 890 Nov 15 13:11 WELCOME
dr-xr-xr-x 2 root other 512 Jul 15 1997 bin
dr-xr-xr-x 2 root other 512 Jul 15 1997 dev
dr-xr-xr-x 2 root other 512 Jul 18 1997 etc
drwxrwxrwx 11 ftp 20 4608 Nov 28 16:00 incoming
lrwxrwxrwx 1 root other 13 Jun 04 1998 ls-lR -> IAFA-LISTINGS
dr-xr-xr-x 17 root root 512 Jun 08 11:43 pub
dr-xr-xr-x 3 root other 512 Jul 15 1997 unc
dr-xr-xr-x 5 root other 512 Jul 15 19