Wings Directory Access
The following steps detail how to set up password protection for a directory on Wings. It is adapted from the NCSA Mosaic User Authentication Tutorial.
- Where is your directory and what is it called?
If you do not know what your Wings directory is then there a few ways of determining this, including:
- If your Wings URL is:
http://wings.buffalo.edu/departments/myarea
then your wings directory is: /net/wings/info/www/departments/myarea - If you access your wings directory by logging onto UBUnix then
cd to your Wings directory and enter the following
command:
pwd
This will return the "present working directory" which is your wings directory.
Keep in mind that your wings directory will always start with: /net/wings/info/www/** The remaining sections on this page will use /net/wings/info/www/departments/myarea as the example wings directory area. In all examples, please replace this reference with your real wings directory area as determined in this step.
The following steps require you to log onto UBUnix to enter the commands.
- If your Wings URL is:
http://wings.buffalo.edu/departments/myarea
- The files you wish to protect must be located in a
sub-directory within your Wings area.
Create a new subdirectory within your Wings directory area by typing:
cd /net/wings/info/www/departments/myarea
mkdir xxxxx(where xxxxx is the name for your new sub-directory)
This new directory (/net/wings/info/www/departments/myarea/xxxxx) will hold the files you wish to protect along with configuration files required to facilitate the password protection mechanism. - Creating the .htaccess file - this seems to be
the most difficult part so please read carefully.
Using a text editor such as pico, emacs, or vi, create a file named .htaccess in the /net/wings/info/www/departments/myarea/xxxxx directory:
cd /net/wings/info/www/departments/myarea/xxxxx
pico .htaccess
The contents of the .htaccess file should be as follows:AuthUserFile /net/wings/info/www/departments/myarea/xxxxx/.htpasswd
AuthGroupFile /dev/null
AuthName "ByPassword"
AuthType Basic
require user SomeName
Notes about the contents of this file:- The .htpasswd file will eventually contain
the usernames that are allowed access to the area and their
corresponding (encrypted) passwords. Instructions for creating
this file are in the next step.
- Leave the AuthGroupFile line alone.
- On the AuthName line, replace the word
ByPassword with the name of the area you are
protecting. This personalizes the authentication window and also
allows the user to browse other files within the area without having
to retype the username and password each time. When a Web browser
requests a URL in your protected directory, a window will appear
saying:
Enter Username for (whatever you replace ByPassword with goes here) at wings.buffalo.edu.
Two text entry boxes will be displayed within the window, one requesting Name, the other Password
- Leave the AuthType line alone.
- On the last line, replace SomeName with the
username you want people to enter into the Name prompt
displayed when accessing the area.
- If you want multiple usernames in the
.htpasswd file to be allowed access, in
.htaccess file replace the following line:
require user SomeNamewith
require valid-user
- The .htpasswd file will eventually contain
the usernames that are allowed access to the area and their
corresponding (encrypted) passwords. Instructions for creating
this file are in the next step.
- Create the .htpasswd file that will contain your
usernames and passwords.
At the Unix prompt, enter the following:
cd /net/wings/info/www/departments/myarea/xxxxx
/net/wings/info/www/cgi-bin/htpasswd -c .htpasswd SomeNameWhere SomeName is the username defined in the .htaccess file you created in the previous step
You will be prompted for a password - enter it.
You will be prompted to retype the password - enter it again.If in step 3 you specified require valid-user, then you may want more than one username/password entry in the .htpasswd file. To add additional entries enter the following command:
/net/wings/info/www/cgi-bin/htpasswd .htpasswd SomeOtherName
This is the same command entered to create the first username, however, the "-c" option was not specified. The "-c" tells the server to create the initial .htpasswd file and thus is necessary when setting up the first username.
- Set the directory permissions.
At the Unix prompt, type:
cd /net/wings/info/www/departments/myarea
chmod 755 xxxxx
cd xxxxx
chmod 644 .htpasswd
chmod 755 .htaccess
Things To Remember/Trouble Shooting
- Everything entered by you in the above steps is case sensitive! For example: .htaccess is not the same as .HTAccess
- Make sure that if you entered a specific user on the require line of the .htaccess file in step 3, it must be exactly the same as what is added to the .htpasswd file in step 4.
- Make sure the permissions on the .htaccess and
.htpasswd files are correct. Enter the "ls -alg" command in
the /net/wings/info/www/departments/myarea/xxxxx directory to check.
The permissions should look like this:
for the .htaccess file:
-rwxr-xr-x (read, write, and executable by you and user group, and, most importantly, read and execute by others)for the .htpasswd file:
-rw-r--r-- (read and write by you but can only be read by your user group and others) - One of the most common errors in the above steps is entering the wrong path for the .htpasswd file. If something is not working properly, double check that your path is correct!
- Also check to make sure you have quotations around the text that replaced the ByPassword text.

