HTMLisEasy.com
HTML tutorials for the rest of us...
  Lock HTTP Authentication: example & run-through  
<< HTTP Authentication Intro

We want to to change into the tutor directory so we'll type cd tutor, then we'll list the contents with ls...

SimpTerm screen capture

Then into the keeper directory...

SimpTerm screen capture

Now there's a lot of stuff in this directory so here's a capture of the SimpTerm window scrolled up a little. We want in the mystash directory.

SimpTerm screen capture

cd into mystash, then ls to display the contents

This is the directory that we want to password protect...

SimpTerm screen capture

The first order of business is to create a .htaccess file for that directory. We'll do that with pico, the UNIX text editor and Notepad, the Windows text editor. First, copy the following into Notepad...

AuthUserFile fullpath/.htpasswd
AuthName "My Secret Area"
AuthGroupFile /dev/null
AuthType Basic

require valid-user

Note the quotes around the AuthName field. When I wrote this piece the quotes didn't seem to be necessary. Now they are. Be sure to use the quotes even though the screen captures that follow don't show them.

You can change "My Secret Area" to whatever you want. It just identifies this password area by name. It is also what appears in the login dialog for this area.

Now, with SimpTerm we'll get the full path of the directory we want to protect. Type pwd...

SimpTerm screen capture

The output is the full UNIX path. Select and copy it to the clipboard...

SimpTerm screen capture

Now paste it into Notepad in place of "fullpath"...

SimpTerm screen capture

SimpTerm screen capture

Now just hang on to this for a minute.

Now, in SimpTerm, crank up pico by typing pico...

SimpTerm screen capture

Copy the entire bit that we did in Notepad...

SimpTerm screen capture

And paste it into pico...

SimpTerm screen capture

SimpTerm screen capture

Now save this as .htaccess

Do this by pressing CTRL+O and typing in .htaccess

SimpTerm screen capture

File is saved.

SimpTerm screen capture

Exit out of pico by pressing CTRL+X...

SimpTerm screen capture

<< BACK NEXT >>
GateKeeper - Javascript Password Protection
GateKeeper 1  ·  GateKeeper 2  ·  GateKeeper 3  ·  HTTP Authentication  ·  The Vault
HTML 4.0 Reference      Barebones HTML Guide