Password protecting a directory

Create a file named ".htaccess" in the directory you want to list. It should contain the following.

   Order deny,allow
   AuthType Basic
   AuthName "Need a password"
   AuthUserFile /home/<your_username>/public_html/dir_to_protect/.htpasswd
   AuthGroupFile /dev/null
   Require valid-user

Now, create the htpasswd file.

   export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
   /www/bin/htpasswd -c /home/<your_username>/public_html/dir_to_protect/.htpasswd 
   New password: 
   Re-type new password:


Password Protecting a directory with NIS

Create a file called .htaccess in the directory you wish to secure with contents similar to this.

      AuthType Basic
      AuthName "NIS Password Required"
      Require user occuser1 occuser2 occuser3
      Satisfy All


Password Protecting a Directory with Kerberos

Create a file called .htaccess in the directory you wish to password protect. It will ask for you Kerberos (in this case, Active Directory) password. If you're like us and using Active Directory servers as your KDCs, then this will eliminate a lot of confusion with your users.

      AuthType KerberosV5
      AuthName "Active Directory Password Required"
      KrbAuthAuthoritative on
      KrbAuthRealm ENGINEERING.UC.EDU
      KrbLifetime 300
      Require user occuser1 occuser2 occuser3