|
Your NMIA full account has webspace provided at the address of http://www.nmia.com/~(USERNAME). In your home directory there is a folder called public_html that is accessible with your username and password via FTP or SSH. To learn more,
click on the appropriate links below. You may print this entire page to keep as a reference or read while off line. |
In order to serve an imagemap, a user foo would use the following
in an html file:
The HREF
tells the server that the map file that it should use is ~foo/public_html/foos.map.
There's nothing special about the root of the users public_html directory. The user foo
could have put the map file in ~foo/public_html/bar/foos.map and used `~foo/bar/foos.map'
for the second part of the HREF.
The SRC is just the location of the image. In the above example, the image is in the same
directory as the file containing the example link. It's just another URL.
The file `foos.map' is called a map file. The format is very simple, and is described
in NCSA's Graphical Information Map Tutorial.
If you read the tutorial, ignore references to `conf/imagemap.conf'. They refer to a bit of configuration
that is not necessary on NMIA.
Back to HTML help for the novice user.
FTP is just a protocol. Many different clients can implement FTP (or parts of it) providing any number of interfaces to FTP. If you have Windows 95 and would like
to try a different ftp client, take a look at the winfiles.com FTP clients page. There are so many clients out there, that we can't know them all intimately. If you
need a lot of support, we suggest that you stay with the 32 bit version of WS_FTP.
When you first start up WS_FTP, you're presented with the Session Profile dialog box. If your version of WS_FTP was pre-configured by NMIA, you have a
profile named `My Account' which you can use to connect to NMIA.
If your copy was not pre-configured by NMIA, you'll probably want to create a profile for your account. To do this:
Note that you can create as many Session Profiles pointing at one site as you'd like. You could, for example, have one for transferring your home page stuff (set up
so that the local and remote directories are convenient) and another one for downloading random stuff to a temporary directory.
Once you've selected the appropriate Session Profile, click on OK and WS_FTP will automatically `log you in' to the host given in the profile.
Once you're logged in, you'll see a representation of your local filesystem on the left and a representation of the remote filesystem on the right. Each side has
directories on top and files on bottom. You can change directories by double clicking on them. You can transfer files by double clicking on them or by single clicking
and then clicking on the arrows.
Before you transfer and files, make sure that you understand the idea of transfer modes.
There are two ways of transferring files: ASCII and BINARY.
Binary Transfer Mode
When a file is transferred as BINARY, it is copied bit for bit from one machine to the other. Both files (the original and the transferred file) will consist of exactly the
same sequence of bytes.
ASCII Transfer Mode
When a file is transferred as ASCII, it may be changed slightly to maintain the meaning of EOL (End Of Line) characters.
Why two modes?
There are two common ways of ending a line in an ascii text file. Unix systems mark the end of a line with a single character, a linefeed (newline; NL or LF; ascii 10
in decimal). DOS marks the end of a line with a pair a characters a carriage return (CR; ascii 13 in decimal) followed by a linefeed.
In order to transfer files and preserve the meaning of these ends of lines, the end of line characters have to be changed. When going from DOS to Unix, CR/LF pairs
have to be transformed to a single LF. Similarly, when going from Unix to DOS, LF's have to be replaced with CR/LF pairs. That's the only difference between the
two transfer modoes.
If you transfer a text file from DOS to Unix as a binary file, it will have carriage returns (often seen as ^M) on the end of each line. In a Unix text file, carriage returns
are just like any other character (except that they're usually invisible).
If you transfer a text file from Unix to DOS as a binary, you'll see a staircase effect when you print it out. That's because DOS just sends files to printers directly and
carriage returns and newlines are taken literally (think about old printers; linefeeds advance the paper and carriage returns move the printing mechanism to the far
left). You'll also see the staircase effect if you type the file.
Choosing a mode
In general images and programs are binary and web pages are ascii text. Note that perl scripts are ascii text.
Command-line ftp clients all function the same, once you're in them.
Once you're in the right directory in your DOS window, start up your FTP client with
the command:
If you entered a valid username and password pair, you should see something similiar to:
There are many other commands, some of them are even useful. You can see a list by
entering the command help.
You should read about transfer modes before you
do a lot of ftp'ing. I know that it doesn't sound too important, but it may save
you some time.
SSH is a service that allows one to make an encrypted TCP connection
to a remote machine. To make use of ssh, one must have a program
(called a "secure shell client") that uses the secure shell service to connect
to a program running on a remote machine (the "secure shell server"). To connect to NMIA via SSH, use plato.nmia.com for the hostname, and don't forget to specify 'ssh' as the connection type.
SFTP
is a hybrid of SSH and FTP, which provides the ability to make an ecrypted TCP connection
and securely transfer files over a network.
To make use of sftp, one must have a program
(called a "secure ftp client") that uses the secure ftp service to connect
to a program running on a remote machine (the "secure ftp server"). To connect to NMIA via SFTP, use ftp.nmia.com for the hostname.
You will have to enter your login password when first using an sftp client. Note, if your username begins with a capital 'P', leave it out while making an sftp connection.
To learn more about sftp, visit the official SSH homepage.
Here are some SFTP clients available for download:
You may change your password to your shell account when logged into home.nmia.com in your SSH session. See SSH if you need help doing so. Type the command "passwd" at your shell prompt. You will be prompted to enter your current password and then your new password. This only changes your shell password (email, FTP, SSH, etc.). It does not change your dialup (PPP) password. If you want the dialup password changed to the same as your shell password, email us at help@nmia.com requesting us to make the PPP password the same as the shell password. There is no need to send your new password in the email and we disscourage you in doing so.
To add a page counter, simply add a line to your html file of the form:
For example, the following:
For more information about the counter see
ssd's counter page.
But, if you wish to proceed you should:
If you get a 500 Server Error error message, your script has generated an invalid HTTP reply
to a client's request for your script. The most common mistakes are:
If you're going to program in Perl, or simply want to confidently configure Perl scripts that you find on
the web, you will find the O'REILLY books on Perl and CGI very helpful.
You can find Perl scripts on the web at a number of locations. A good place to start looking is
the Yahoo CGI Perl script section.
Back to Counters, CGI, forms and access control on NMIA.
Forms allow you to collect information from people that look at your page.
The form interfaces are simple and easy to use.
There are three different form handling cgi programs that you can use on NMIA:
To do this, you'll need to know how to write an html form. A good place to start learning about
forms is
An Instantaneous Introduction to HTML Forms.
If you have questions about
forms in general, your best bet is to post to one of the
www newsgroups.
Second, you must add
Only one input tag is required. You must have an input tag that has the name
recipient and your email address as its value.
If you want to send to multiple recipients, just make the value a list of email address separated by commas (no spaces). For example:
For a description of the optional input tags that you can use to customize the behavior of formmail,
take a look at the formmail documentation.
Access control on our http server is controlled by directory. All files in
a particular directory have the same authorization requirements.
There are two forms of access control, user authentication and
host filtering. User authentication involves setting up a password
file, assigning usernames, and assigning passwords. If you want
someone to access your page, you tell them to use a particular
username/password combination. Host filtering simply allows
access to some hosts and denies access to others.
In order to control access by user authentication, you'll need to create a file containing
user/password correspondences and tell our server to use that file to authenticate users.
You create the file by using the htpasswd program. To tell our server to use user authentication in a particular directory, you
just create a file named .htaccess in the directory that you want to protect and put in the appropriate
access control directives.
If you just want to jump in without reading the documentation, you can probably modify the following example to suit your needs. Otherwise, visit
this site for more detail. Suppose that I want to create
a directory where I can put files to be accessed only by people who have a password that I've given them.
Here's what I'd do:
Now, when I try to access:
PHP is a preprocessor for HTML.
To process one of your pages with PHP, you must put the page under your
cgi-bin directory
and the first line of the page must be:
You would reference the page as:
where USERNAME is your username and SCRIPTNAME is the path to your page
relative to your cgi-bin directory. Note the /new/ in the path.
Here are some ways to add links to various places:
You can also use the Submit It! form
to register your page with several sites at once.
If you come across a page where you think that a link to your page would be
appropriate, there's no harm in sending email to the owner of the page
asking for a link. Most pages contain author contact information.
Many people have a pointer to their home page in the signature that
they use for Usenet news postings and email.
The same holds true for mailing lists.
Newsgroups are uncensored collections of information on any topic you can think of.
You can access those groups by going to Deja News
or by getting a news group client.
Such clients are later versions of Netscape Navigator,
Outlook Express,
or Forte Inc's Free Agent.
The following newsgroups have information about the WWW:
When connected to NMIA you do not need to login or supply a username and password to get the newsgroups
that are on our server. Just use the server news.nmia.com.
Maintained by NMIA.Imagemaps on NMIA
FTP
Back to FTP and SSH.
Using WS_FTP
Back to the top of FTP.
FTP Transfer Modes
Back to the top of FTP.
Using a Command-line FTP Client
Windows 95 and higher has a very nice FTP client built in. To use it, open up a DOS window
and go (using the cd command) to the directory containing the files that
you want to upload or to a directory to which you'd like to download files.
ftp
which will give you a prompt that looks like:
ftp>
Now type:
ftp>open servername
Once you enter the above command, you'll be prompted for a username. If you're ftp'ing to
your account on NMIA, enter your NMIA username. If you're connecting to a site that you
don't have an account on, use the username "anonymous". Next you'll be asked for
a password. If you're ftp'ing to your account on NMIA, use your shell account password. If
you used the username "anonymous", use your email address as the password.
220 User username is logged in.
ftp>
If you still only see
ftp>
Then you aren't connected. Try the "open servername" command again.
At this prompt, you can enter many different commands. Here is a summary of some
of the most useful:
ftp>ldir
would list all the files in the current directory of your local machine.
ftp>lcd /this/folder
Back to FTP.
SSH
You will have to enter your login password when first using an ssh client. Note, if your username begins with a capital 'P', leave it out while making
an SSH connection.
To learn more about ssh, visit either of these sites:
General Background
Official SSH Home Page
If you don't have an ssh client already, putty is a pretty good one
and many others for various operating systems are listed below.
Windows 95, NT, 98, ME, XP; Freeware.
Back to FTP and SSH.
SFTP
Unix Commands
This is a list of some of the programs available by function. There are many
more. Commands are either executable files in the directories specified by the
value of your PATH environment variable or built in commands defined by your
shell (see the manual page on your shell).
Mail:
mail - Berkeley mail reader, very basic
mutt - Powerful mail user agent (NMIA's recommendation)
elm - a nice mail reader
pine - a very nice mail reader *Not to be used with oversized spools)
News readers:
tin - probably the easiest to use
trn - threaded news reader
strn - complex news reader with scoring
Infosystems:
lynx - http client (browse documents on http/ftp/gopher/etc sites)
gopher - gopher client (browse documents on gopher servers)
archie - archie client (search for files on ftp sites)
define - webster client (look up a words on a remote webster site)
weather - local weather
FTP clients:
ftp - transfers files over a network
ncftp - a fancy version of ftp
sftp - securely transfers files over a network
Editors:
vi - the standard unix editor, small, efficient
pico - a user friendly editor
jove - a small emacs-like editor
joe - feel of a `user-friendly PC editor'
ed - the most user-unfriendly editor ever written
Most programs that use editors (mail/news readers) will use the editor
specified by the EDITOR environment variable.
File manipulation:
cp - copies files
mv - moves files/directories
cat - concatenates files
rm - removes files/directories
mkdir - makes directories
chmod - changes file/directory permissions
ln - makes symbolic links
Job control:
ps - lists your processes
kill - kills (send a signal to) processes
jobs - lists your background jobs
fg - puts a job in the foreground
nohup - runs a program with hangup signals ignored
File information:
ls - lists files/directories
du - displays disk usage
strings - finds strings in a binary file
file - guesses the type of file
find - searches for files
Compression/decompression:
gzip/gunzip - for 'z' files
compress/uncompress - for 'Z' files
zip/unzip - for 'zip' files
Archiving:
tar
Pagers:
more - view a file one page at a time
less -
Downloading/Uploading:
rz - Z modem protocol
sz - Z modem protocol
kermit - kermit protocol
Shells:
bash - sh the GNU way
tcsh - enhanced c shell
Text processing:
awk - a programming language for operating on files line by line
sed - stream editor
grep - search files for regular expressions
cut - display parts of each line of a file
tail - display the tail of a file
head - display the head of a file
cat - concatenate files
sort - sort lines of a file
column - columnate lists
Misc:
cd - change your current working directory
date - print the date
ssh - used to connect to remote sites
talk - for conducting a conversation with a particular user
tf - the TinyFugue MUD client
irc - IRC client
finger - list basic information about a user or users at a site
passwd - change your password
chsh - change your login shell
chfn - change the information that appears when someone fingers you
man - browse manual pages
uuencode - encode files for transmission via news/mail
uudecode - decode uuencoded files
uuxfer - uuencode with a curses interface
fortune - prints a humorous message (nice for .profile)
yow - prints a ZIPPY message (nice for .profile)
Back to FTP and SSH.
Bourne Again SHell
The manual page for bash is very long and can be confusing. Here are some
examples of some of the basic features. For a complete description of the
bash shell see `man bash'.
Home directories:
ls -al ~
echo ~
In general ~ refers to your home directory.
Redirection:
w > ~/w.out
ls -al /usr/bin > ~/ls.bin.out
You can use `>' to redirect the output of commands to a file. Note that
`>' will write over the destination file if it exists. To simply append
to a file, use `>>'.
Command history:
echo !!
history
echo !2
You can refer to previous commands using `!n' where `n' is the number
of the command in your history list. You can repeat the previous command
with the command `!!'. You can see your history list with `history'.
Command line editing:
^p -move backwards through your history list
^n -move forwards through your history list
^f -forward a character on the current line
^b -backward a character on the current line
^d -delete the current character
^k -kill from point to the end of the line
^a -move point to the beginning of a line
Note that `^p', for example, is the character generated when you press the
`Ctrl' key and the `p' key simultaneously.
Pipes:
ls /usr/bin | more
ls /usr/bin | grep g | more
ps -aux | grep root
The pipe operator `|' connects the standard output of the command on the
left to the standard input of the command on the right.
Background jobs:
Compare:
sleep 5; echo foo
to
sleep 5; echo foo &
An ampersand following a command causes the shell to run the command
in the background, allowing you to do other things while the command is
running.
Variables:
FOO=bar
echo $FOO
env
Aliases:
alias foo='ls /usr/bin | more'
foo
Starting up:
When your shell starts up, the file ~/.profile is read and the commands
in it are executed. Your profile file is a good place to put aliases.
Back to FTP and SSH.
vi
The vi Editor
I Introduction
Vi is useful for creating new text, revising an existing text, and
appending text to an existing file. Although there are many
commands available in vi, you will be introduced only to the
commands for entering and exiting vi, moving the cursor, and
inserting and deleting text. You must refer to a Unix manual for
other commands.
II The two modes of vi
The vi text editor has two distinct modes of operation, the edit
mode and command mode.
The edit mode is the mode in which you type text. Each
character appears on the screen as you type it.
In the command mode, it is impossible to type text. The
command mode allows you to move the cursor around the text and to
perform functions, such as deleting text and saving the file.
III Entering the vi text editor
To create a new document in vi , simply type, vi "file name". This
command will display the vi editor screen accompanied by the name
of the new document followed by the statement, "[New file]".
EXAMPLE:
% vi practice
In this example, the new file "practice" is created.
The screen will look like this after opening a new file entitled,
"practice".
=============================================================
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"practice" [New File]
=============================================================
IV The Edit Mode
Once in vi, you are placed in the command mode. You cannot enter
text in this mode. If you try, the error bell rings and the letters you
try to type will not appear on the screen. This is because ordinary
letters are interpreted as commands.
You must enter the edit mode to type text.
To do so, use one of the following commands. The vi text editor is
case sensitive, which means the same letters in upper and lower
case have different command responses.
The letters a, A, i, I, o, and O place vi into edit mode.
* the a command moves the cursor to the right one space
* the A command moves cursor to the end of the current line
* the i command inserts text in front of the cursor
* the I command moves cursor to beginning of the current line.
To correct mistakes while in the edit mode, use the backspace key to
correct errors in the current line you are typing. As you backspace
to correct the mistake, characters remain on the screen although
they are erased in the computer's memory. This looks confusing but
donŐt be worried by it. To correct mistakes in lines other then the
current line, you must first enter the vi command mode. This will
allow you to move the cursor to the line you want to edit (see
section VI.)
V Leaving the Edit Mode and Moving the Cursor
To return to the command mode simply press the ESC key. (Hint: if
you are not sure which mode you are currently in, press the ESC
anyway. If you were already in command mode, you will stay in the
command mode.) In the command mode, it is possible to move the
cursor up, down, left or, right by using the arrow keys on the
keyboard. However, no matter what type of keyboard you have, it is
possible to use the vi commands, h, j, k, and l, all in lowercase, to
control the cursor.
These commands move the cursor as follows:
* the j command moves the cursor up one line
* the k command moves the cursor down one line
* the h command moves the cursor backwards on a line, similar
to the backspace key
* the l command moves the cursor forward on a line, similar to
the spacebar.
If you want to insert text, simply move the cursor to the desired
area, while in the command mode, return to edit mode and type the
text.
VI Deleting Text
It is only possible to delete text while in command mode. (See
section VI for entering command mode.)
*the dw command deletes the word the cursor is on.
*the dt command deletes everything from the cursor to the
next period on the current line. This is a good way to delete words
to the end of the sentence without deleting the period.
*the d( command deletes everything from the cursor to the
beginning of the next sentence. After moving the cursor to the
beginning of a sentence, you can use this command to quickly delete
that sentence.
*the dG command deletes everything from the cursor to the
end of the file
VII Editing an Existing File
It is also possible to edit an existing file. In this case, enter by
typing vi followed by the name of the file to be edited.
EXAMPLE:
% vi "letter"
In this case the user entered vi and opened an existing file entitled,
"letter". The text of the file requested appears on the screen. At
the bottom of the screen the file name, # of lines in the text, and #
of characters in the text appear.
EXAMPLE:
=============================================================
To whom it may concern,
I am interested in signing up for the data communication class that
the school of design is offering in the fall. I am a student of the
colleges and need this class to fulfill my major. If you could send
me the application form, I would greatly appreciate it. It would be
best to send the form to me through the internet in a email message.
My address is as follows
Jack Straw
576 St. Paul Blvd.
New York, NY 10021
~
~
~
~
~
~
~
~"letter" 10 lines, 387 characters
=============================================================
VII Saving Your Work and Exiting the vi Text Editor
To save your text, first enter the command mode. Once in command
mode, it is possible to save and exit, or to exit without saving. The
command sequence is as follows
:w saves your text
:q quits vi
:wq saves and quits vi
These commands are examples of what are called last line
commands. When they are used, the cursor moves to the bottom of
the page. Your commands and the systems response are displayed
there.
IX Conclusion
There are many other commands for the vi editor. Entire books have
been written explaining the use of vi commands. The purpose of this
brief guide is to introduce you to enough basic vi commands for you
to do useful work. To learn about more advanced features, refer to a
Unix manual or a book on vi.
Back to FTP and SSH.
Changing your shell password on NMIA
Back to FTP and SSH.
Adding a Page Counter on NMIA
which shows how many times this page has been accessed.
Back to Counters, CGI, forms and access control on NMIA.
CGI on NMIA
Overview
NMIA serves user cgi scripts
via a wrapper program. The wrapper program executes a user's script using
the user's uid as its effective uid. In other words, the cgi script has
the same `permissions' as the user that owns it. The script can do anything
that the user could normally do.
Getting started
You can serve cgi scripts, but there are some dire warnings you should know
about first. It is possible to write a simple script which will destroy
everything in your account directory, or make very subtle changes in it that
would be difficult to diagnose. That is, you should know a good bit about unix
and shell programming and possibly about perl or other languanges you intend
to use, before setting scripts loose to be run by strangers through your
web site.
Using the wrapper to call your scripts
After your cgi-bin directory has been enabled, you can access scripts under it
with a URL like:
Debugging your cgi scripts
You can use cgiwrapd in place of cgiwrap to produce helpful
debugging info.
Programming resources
The most popular programming language for CGI applications is Perl. NMIA has support for Perl version 5 inluding
the Perl module CGI.pm which greatly simplifies the writing of CGI scripts.
Using Forms on NMIA
Back to Counters, CGI, forms and access control on NMIA.
FormMail
What is FormMail?
FormMail is a freely available script available from
Matt's Script Archive. It is
highly configurable and is recommended over the older form-mail (note the dash ) script.
How to use formmail
To use Fmail, you must do two things. First, you must use the following URL as the value of
the action attribute of your form:
http://www.nmia.com/cgi-bin/formmail
For example:
input type=hidden name="recipient" value="devnull@nmia.com"
input type=hidden name="recipient" value="addr1@nmia.com,addr2@foo.com,add3@bar.com"
Back to the forms help.
Access Control
Back to the forms help.
User Authentication
Create the directory
I'll call my diretory `private' and put it directly under my public_html directory:
Create the password database
I'll add a couple of users, one for me and one for my friend, Opus:
htpasswd -c ~/.my_passwd_file ron
htpasswd ~/.my_passwd_file opus
In each case, I'll be prompted to for a password. The first
command has a -c. That tells htpasswd that we're starting a
new password file. Don't use it on subsequent commands unless
you want to wipe your old password file.
Tell the server
To tell the server to use authentication, I'll create a .htaccess file in
~/public_html/private. To do this, I'll use my a text editor and I'll put the
following in it:
http://www.nmia.com/~foo/private/
I'll be prompted for a password. When playing around with passwords, remember that your client
probably remembers passwords so that once you give a valid password, you won't be prompted again
until you restart the client.
PHP on NMIA
Back to Counters, CGI, forms and access control on NMIA.
Spreading the word about your page
How to do it
Most people find out about web pages by using one of the popular search engines
like Lycos or a large
catalogue like Yahoo.
How not to do it
You should avoid simply announcing your page on a Usenet newsgroup,
particularly if it's a commercial page. If you maintain a page with information
that answers a question that you see asked in a newsgroup, it's acceptable to
post a pointer to that page.
Back to Publicizing your page and other fun stuff.
WWW Newsgroups
Back to Publicizing your page and other fun stuff.
All rights reserved. Last modified: 2000