[comp.unix.questions] Info. &| source for FTP

moraes@cs.toronto.edu (Mark Moraes) (09/04/90)

FTP (File Transfer Protocol) is an Internet protocol that can be used
over TCP/IP networks to transfer files. anonymous ftp is a facility
offered by many Internet sites to make software and data available to
other Internet sites.  See the note below (it's from our local help
file -- comments and criticism by EMAIL to me, please)

The Unix ftp program and ftp daemon are available from the Berkeley
networking distribution.  They're also available in packages like NCSA
Telnet for the Mac and IBM-PC.  It won't do you much good if you don't
have TCP/IP connectivity in some form.

If you don't have TCP/IP connectivity, you can get the programs that
are available for anon ftp by checking by uucp to osu-cis.  (Details
posted periodically on comp.sources.d by Karl Kleinpaste)
Alternatively, if you're a uunet subscriber, you can ask them to snarf
a copy for you and then uucp it.

Finally, some sites operate mail servers that will ftp stuff for you
and then mail it to you.  Send a message with "help" in it to
bitftp@pucc.princeton.edu.  (Be warned: Mail is a HORRIBLY inefficient
and anti-social way of transferring files -- you can get your uucp
neighbours or gateways really mad at you if you do this.  It's far
better to pay a few dollars and use uucp to osu-cis or uunet)

I've redirected followups to comp.unix.questions.  This has nothing to
do with internals or Unix on 386s.  (other than vendor mindlessness in
not supplying Berkeley networking software and/or on-line manuals for
it)

	Mark.

 -------------------
       Using "anonymous ftp" to get files from other machines

              Mark Moraes, University of Toronto

Anonymous ftp is a facility offered by many machines on the Internet.
This permits you to log in with the ftp program 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.

You can then look around and retrieve files. (Most anonymous ftp sites
do not permit people to store files)  The ftp program prompts you with

ftp>

and offers a few commands that are similar to Unix.  "cd" changes your
directory on the remote machine, "lcd" changes your directory on the
local machine, "get" will get a file, etc. See the manual page for ftp
(use the command "man ftp")

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.

Usually, files are grouped in archive files, so you don't have to get
many small files separately. The most common archival file format for
the Internet is tar. Occasionally, people use shell archives (shar)
instead. tar archives can be unpacked by running the tar command --
you may want to first do a 'tar t' on the file to see what it contains
before unpacking it. Be careful when unpacking shell archives since
they have to be run through the Bourne shell to unpack them. (The
simplest way is to use the unshar command)

Files are often stored compressed -- for Unix, the most common scheme
is the compress program, indicated by a .Z suffix on the file name.
Sometimes, people use programs like arc or zoo, which are combined
archival and compression formats. (There are probably other archival
formats as well - talk to the systems staff if you encounter them and
don't know how to deal with them)

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. If the site at the other end is
non-Unix, you may need to use some other mode -- see the documents for
that site and for ftp)

An example session follows -- the commands I typed are all underlined
with a row of carets (^^^^) and are usually typed at the % or ftp>
prompt.

% ftp cs.toronto.edu
  ^^^^^^^^^^^^^^^^^^
Connected to cs.toronto.edu.
220 neat.cs FTP server (Version 5.55 Tue Aug 8 22:48:27 EDT 1989) ready.
Name (cs.toronto.edu:moraes): anonymous
                              ^^^^^^^^^
331 Guest login ok, send ident as password.
Password:moraes@csri.toronto.edu
         ^^^^^^^^^^^^^^^^^^^^^^^
230 Guest login ok, access restrictions apply.
Remote system type is UNIX.
ftp> dir
     ^^^
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
total 62
drwxr-xr-x  2 0        0             512 Nov 20  1988 bin
drwxr-xr-x 11 0        0            2048 Dec 29 00:45 pub
226 Transfer complete.
ftp> cd pub
     ^^^^^^
250 CWD command successful.
ftp> dir
     ^^^
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
total 4523
...
-rw-r--r--  1 0        0           51251 Sep 16 12:02 ssl.tar.Z
...
226 Transfer complete.
ftp> hash
     ^^^^
Hash mark printing on (1024 bytes/hash mark).
ftp> binary
     ^^^^^^
200 Type set to I.
ftp> get ssl.tar.Z
     ^^^^^^^^^^^^^
200 PORT command successful.
150 Opening BINARY mode data connection for ssl.tar.Z (51251 bytes).
##################################################
226 Transfer complete.
51251 bytes received in 0.94 seconds (53 Kbytes/s)
ftp> quit
     ^^^^
221 Goodbye.

Now, to see what ssl.tar.Z contains, I can use:

% uncompress < ssl.tar.Z | tar tvf - 
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
drwxrwxr-x 7/0        0 Sep 16 11:58 1989 ssl/
-rw-r--r-- 7/0      301 Sep 16 11:58 1989 ssl/Makefile
-rw-r--r-- 7/0      240 Jun  2 01:08 1988 ssl/README
-rw-r--r-- 7/0    20642 Feb 26 21:43 1988 ssl/file.ssl
-rw-r--r-- 7/0     5241 Feb 21 15:25 1988 ssl/file.sst
-rw-r--r-- 7/0    56581 Sep 16 11:57 1989 ssl/ssl.c
-rw-r--r-- 7/0    20642 Feb 26 20:08 1988 ssl/ssl.ssl
-rw-r--r-- 7/0     5241 Feb 26 21:41 1988 ssl/ssl:sst.c
-rw-r--r-- 7/0     5395 Feb 26 21:41 1988 ssl/ssl:sst.h
-rw-r--r-- 7/0    12211 Mar 30 22:34 1988 ssl/sslskel.c
-rw-r--r-- 7/0      274 Feb 26 20:42 1988 ssl/sslskel.ssl
-rw-r--r-- 7/0       55 Feb 26 20:42 1988 ssl/sslskel.sst.c
-rw-r--r-- 7/0     1001 Feb 26 20:42 1988 ssl/sslskel.sst.h

To extract the files, I use

% uncompress < ssl.tar.Z | tar xvf - 
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ssl/
ssl/Makefile
ssl/README
ssl/file.ssl
ssl/file.sst
ssl/ssl.c
ssl/ssl.ssl
ssl/ssl:sst.c
ssl/ssl:sst.h
ssl/sslskel.c
ssl/sslskel.ssl
ssl/sslskel.sst.c
ssl/sslskel.sst.h