 |
Password-protected Web directories
The following requires some familiarity with the UNIX shell or a spirit of
adventure and the ability to follow instructions carefully.
- lines beginning with $ indicate command lines. Type in the
text that follows the $.
- lines beginning with # are comments.
Dial up or SSH to Prairienet (prairienet.org). Select the UNIX shell option
from the menu.
From UNIX shell:
$ pwd
/home/DIRNUM/USERNAME
Make note of the number, this is your directory number.
DIRNUM = directory number
USERNAME = your regular login name
HTLOGIN = login name for the password-protected directory
PASSWORDFILE = name of password file
$ cd /content/web/users/DIRNUM/USERNAME
$ mkdir security # create the directory for your password
$ cd security
$ htpasswd -c PASSWORDFILE HTLOGIN # create your encrypted password file
You will be prompted for your password.
In directory to be password-protected, create the file .htaccess:
---------------------------cut here ---------------------------------
AuthUserFile /content/web/users/DIRNUM/USERNAME/security/PASSWORDFILE
AuthType Basic
AuthName "Descriptive title for your users"
order deny,allow
require valid-user
---------------------------cut here ---------------------------------
Test access to your password-protected directory from your Web
browser. You should be prompted for your username and password.
You can create a shortcut from your home directory to your security
directory as follows:
ln -s /content/web/users/DIRNUM/USERNAME/security security
You're all done!
==================================================
EXAMPLE
===================================================
Create security directory and password file
---------------------------------------------------
$ pwd
/home/36/xx700
$ cd /content/web/users/36/xx700
$ mkdir security
$ cd security
$ htpasswd -c .htpasswd.admin admin
New password:
Re-type new password:
Adding password for user admin
Create .htaccess file in protected directory:
----------------------------------------------------
AuthUserFile /content/web/users/36/xx700/security/.htpasswd.admin
AuthType Basic
AuthName "HSN Admin"
order deny,allow
require valid-user
----------------------------------------------------
Create link from home directory to security directory
-----------------------------------------------------
$ cd # switch to home directory
$ ln -s /content/web/users/36/xx700/security security
$ cd security # test symbolic link
|
 |
|
|