Basic Auth with htpasswd

Overview

If you would like to protect a subdirectory with a basic username and password

  • Connect to one of the ETS Linux machines.
  • Create a “.htaccess” file in the directory that contains the items you want to protect.
Authtype Basic
AuthName "Put whatever you want here"
AuthUserFile <path to your htpasswd file>
Require valid-user

The path to your file should be your full Unix home directory.

For faculty/staff it might look like this: /top/people/home/public_html/.htpasswd
For students: /top/students/people/home/public_html/.htpasswd

 

  • Creating a password file is done by using the “htpasswd” command like this:
    htpasswd -c /httpdocs/foo/.htpasswd fred

 

The “-c” option creates the file for the first time. Don’t use it if you are adding another user to an existing file. “fred” is the username you are adding. It will then ask you for a password and then to confirm it. After that you should be able to access the URL and be asked for the username and password.

Walter Scott, Jr. College of Engineering logo

Engineering Technology Services

Bookmark and use our online help desk form first.
 

Email help@engr.colostate.edu
Call (970) 491-2917
 

Stop by an ETS Help Desk:
Main Help Desk (Glover 100)
Foothills Campus Help Desk (Atmospheric Science 107)
Academic Village Help Desk (AVB C142, next to the Orion Design Studios)