Using FTP
Home Up Stream A Stream B Shell Skills RegExp Skills Perl Skills Resources Using FTP Web Logs Permissions Notes 1 Notes 2 Inodes Unix exploit - PATH

 

Using FTP on the Internet

If you're connecting to the Internet from a non-Algonquin Internet provider (e.g. magi.com, freenet), realize that your provider doesn't know where "netsrv" is. You need to give the full host name "netsrv.algonquincollege.com" in any place where you need a host name, e.g.:

http://netsrv.algonquincollege.com/~abcd0001/
http://www.algonquincollege.com/~abcd0001/ 

Note that "netsrv.algonquincollege.com" and "www.algonquincollege.com" are the same machine and the names are completely interchangeable:

$ host netsrv.algonquincollege.com 
netsrv.algonquincollege.com has address 205.211.41.2 
$ host www.algonquincollege.com
www.algonquincollege.com is a nickname for netsrv.algonquincollege.com
netsrv.algonquincollege.com has address 205.211.41.2 

If you type in an FTP-style URL to Netscape (one beginning with "ftp://hostname"), Netscape logs in as the "anonymous" FTP user, not as you. If you use "Publish" in Netscape Composer, and give an FTP-style destination, Netscape does log in as you because you can give Netscape your userid and password.

Here are some examples of the differences among these various approaches:

Example 1:

To connect to the NETSRV public "anonymous" FTP site using your browser, type this as an FTP-style URL into your browser:

	ftp://netsrv.algonquincollege.com/  

You will see a list of the "public" files and directories under the "anonymous" FTP account on NETSRV.  You cannot get to your files in your own directory from here; it isn't allowed.  Anonymous FTP can't get to your home directory.  You are restricted to the anonymous FTP directory when you log in this way.

Example 2:

To connect to the NETSRV public "anonymous" FTP site using the FTP program itself (not using a Web browser), do it like this:

    $ ftp netsrv.algonquincollege.com
    Connected to netsrv.algonquincollege.com.
    220 netsrv FTP server (Version wu-2.4(2) Fri May 22 11:25:43 EDT 1998) ready.
    Name (netsrv.algonquincollege.com:idallen): anonymous
    331 Guest login ok, send your complete e-mail address as password.
    Password: idallen@freenet.carleton.ca
    230-                    Welcome to Algonquin College FTP Site
    230-
    230-
    230 Guest login ok, access restrictions apply.
    Remote system type is UNIX.
    Using binary mode to transfer files.
    ftp> ls
    200 PORT command successful.
    150 Opening ASCII mode data connection for /bin/ls.
    total 22
    drwxr-xr-x   9 0        1            512 Jun 19  1998 .
    drwxr-xr-x   9 0        1            512 Jun 19  1998 ..
    lrwxrwxrwx   1 0        1              7 Oct  6  1996 bin -> usr/bin
    drwxr-xr-x   2 158      225          512 Jun 19  1998 comptel
    dr-xr-xr-x   2 0        1            512 Oct  6  1996 dev
    dr-xr-xr-x   2 0        1            512 May  7  1998 etc
    drwxr-xr-x   3 315      438          512 Jul 19 21:58 kanata
    drwxr-xr-x  19 0        0            512 Dec  4 19:55 pub
    drwxr-xr-x   3 315      437          512 Jul 19 21:58 tec
    drwxr-xr-x   5 0        1            512 Oct  6  1996 usr
    -rw-rw-r--   1 0        1             46 Jun  8  1998 welcome.msg
    226 Transfer complete.
    ftp> quit
    221 Goodbye.  

Remember, you cannot get to your own files via the "anonymous" FTP login.

When you type an FTP-style URL into Netscape (or any browser), Netscape actually does the above login sequence for you and presents the results as an HTML page.  Netscape acts as a GUI "front end" to the command-line FTP protocol.

Example 3:

To connect to your own NETSRV FTP site using the FTP program itself (not using a Web browser), you need to give your own userid and password to the FTP program, like this:

    $ ftp netsrv.algonquincollege.com
    Connected to netsrv.algonquincollege.com.
    220 netsrv FTP server (Version wu-2.4(2) Fri May 22 11:25:43 EDT 1998) ready.
    Name (netsrv.algonquincollege.com:idallen): abcd0001
    331 Password required for abcd0001.
    Password: XXXXXXXXX
    230-	**************************************************************
    230-	 Welcome to the Algonquin College WWW and ftp server.
    230-
    230-	 This server is used primarily for downloading and/or
    230-	 uploading course related and Web related files.
    230-
    230-	**************************************************************
    230-
    230 User abcd0001 logged in.
    Remote system type is UNIX.
    Using binary mode to transfer files.
    ftp> cd public_html
    250 CWD command successful.
    ftp> cd cgi-bin
    250 CWD command successful.
    ftp> ls
    200 PORT command successful.
    150 Opening ASCII mode data connection for /bin/ls.
    total 40
    drwxr-xr-x   2 abcd0001	inetusr     512 Jan  6 09:14 .
    drwxr-xr-x  19 abcd0001	inetusr    1024 Nov 15 00:23 ..
    -rwxr-xr-x   1 abcd0001	inetusr    1967 Jan  6 09:16 happy.cgi
    -rwxr-xr-x   1 abcd0001	inetusr    1592 Jan  6 09:26 today.cgi
    226 Transfer complete.
    ftp> quit
    221 Goodbye.  

Example 4:

The ftp program will work in a similar fashion on Unix or in a DOS window under Windows95.  Using Windows FTP you can connect to the anonymous FTP site, or to your own home directory:

    C:\>ftp netsrv.algonquincollege.com
    Connected to netsrv.algonquincollege.com.
    220 netsrv FTP server (Version wu-2.4(2) Fri May 22 11:25:43 EDT 1998) ready.
    User (netsrv.algonquincollege.com:(none)): abcd0001
    331 Password required for abcd0001.
    Password: XXXXXXXX
    230-    **************************************************************
    230-     Welcome to the Algonquin College WWW and ftp server.
    230-
    230-     This server is used primarily for downloading and/or
    230-     uploading course related and Web related files.
    230-
    230-    **************************************************************
    230-
    230 User abcd0001 logged in.
    ftp> cd public_html/cgi-bin
    250 CWD command successful.
    ftp> ls
    200 PORT command successful.
    150 Opening ASCII mode data connection for file list.
    happy.cgi
    today.cgi
    226 Transfer complete.
    ftp: 44 bytes received in 0.00Seconds 44000.00Kbytes/sec.
    ftp> ls -l
    200 PORT command successful.
    150 Opening ASCII mode data connection for /bin/ls.
    total 36
    -rwxr-xr-x   1 abcd0001   inetusr    1967 Jan  6 09:16 happy.cgi
    -rwxr-xr-x   1 abcd0001   inetusr    1592 Jan  6 09:26 today.cgi
    226 Transfer complete.
    ftp: 270 bytes received in 0.00Seconds 270000.00Kbytes/sec.
    ftp>quit
    221 Goodbye.
    C:\>exit  

Example 5:

When you use Netscape's "Composer" program to edit an HTML page, and you want to "Publish" the page back to your server, you have to specify exactly where to put the page (the full absolute pathname), and whether to use FTP or HTTP uploading.

In Composer, when you select the "Publish" button, you are presented with a dialog box.  In that box is an entry field labelled "HTTP or FTP Location to publish to:".  Into this box you put a (long) absolute FTP path that points to where you want to put your page on NETSRV, e.g. you would use something like this:

    ftp://netsrv.algonquincollege.com/export/home1/inetu2/abcd0011/public_html/index.html  

The exact pathname may be different for your account, since some student home directories are stored under "inetu" and not under "inetu2".   If you get an error, try the other one.  You can find out which directory it is by using the FTP program to query your own account using "pwd":

    $ ftp netsrv.algonquincollege.com
    Connected to netsrv.algonquincollege.com.
    220 netsrv FTP server (Version wu-2.4(2) Fri May 22 11:25:43 EDT 1998) ready.
    Name (netsrv.algonquincollege.com:idallen): abcd0001
    331 Password required for abcd0001.
    Password: XXXXXXXX
    230 User abcd0001 logged in.
    Remote system type is UNIX.
    Using binary mode to transfer files.
    ftp> pwd
    257 "/export/home1/inetu/abcd0001" is current directory.
    ftp> quit  

This (long) absolute FTP pathname cannot be typed as a URL into a browser.
It only works as a "Publish" FTP pathname in the Netscape Composer.

FTP Commands

For a list of commands available in FTP, type "?" or "help".   See also the Unix "man" page.

    ftp> ?
    Commands may be abbreviated.  Commands are:
    !               debug           mdir            sendport        site
    $               dir             mget            put             size
    account         disconnect      mkdir           pwd             status
    append          exit            mls             quit            struct
    ascii           form            mode            quote           system
    bell            get             modtime         recv            sunique
    binary          glob            mput            reget           tenex
    bye             hash            newer           rstatus         tick
    case            help            nmap            rhelp           trace
    cd              idle            nlist           rename          type
    cdup            image           ntrans          reset           user
    chmod           lcd             open            restart         umask
    close           ls              prompt          rmdir           verbose
    cr              macdef          passive         runique         ?
    delete          mdelete         proxy           send  
    ftp> help rename
    rename          rename file