CAE has two quick ways for you to limit access to areas of your web site. All files and folders inside a folder with the name of cae-auth require a CAE username and password to access. If you name the folder uw-only then access is available to only those viewing your site from computers on the UW-Madison campus, including the dial-up lines. Below you will find instruction on how to create your own personalized access restrictions.
You can protect files with password access with passwords you set yourself. There are two primary parts to creating your own access restricted pages. First, create a password file and populate it with usernames and passwords. Second, limit the access using your own password file.
You can protect files with password access with passwords you set yourself. All password-protected directories should be stored in your public_html directory and also beneath an https-only/ directory (so that the passwords are transmitted securely). An example would be public_html/https-only/mydir/. Your password file will contain a list of names and encrypted passwords. It should be stored inside the same directory that you want to password protect, and be publicly readable. You should name your file .htpasswd, because the server is configured to not reveal the contents of any file that begins with .ht to the outside world. If your password file has any other name it risks being viewed by unauthorized users who could then view your protected data.
The -c flag will create a new file. htpasswd will prompt you for the password twice and will add it to the file (or create the file if you use -c). The command should also be used to modify password for users already with a password in the file.
chmod a+r .htpasswd
Example: In the home/public_html/https-only/ directory create a password file named protected for the usernames: bucky and guest. Set the access to the passwordfile readable by all.
sun-123% cd
sun-123% htpasswd -help
Usage: htpasswd .htpasswd username
sun-123% htpasswd -c .htpasswd bucky
New password:
Re-type new password:
Adding password for user bucky
sun-123% htpasswd .htpasswd guest
New password:
Re-type new password:
Adding password for user guest
sun-123% chmod a+r .htpasswd
The initial cd command is to ensure the working directory is the home directory. The htpasswd command will create a file named .htpasswd and add a password for bucky. Another password is added to the file for guest. Additional htpasswd commands should not include the -c option.
With the password file created, you are now ready to start restricting access to your web pages using this file.
public_html directory and within a https-onlydirectory.
chmod a+rx directoryname
AuthType basic
AuthName "Password Protected Area"
AuthUserFile /pong/usr0/b/badger/public_html/https-only/.htpasswd
require valid-user
pwd to get the full path.) This means that to gain access to the pages you put in this directory the user must enter a valid username and password from the password file.
chmod a+r .htaccess
Pages can also be set to only be accessible to particular users, by putting the following 'require' lines in .htaccess instead of the above:
require user user1 user2 user3
Be sure you have a password defined in your password file for the specified users.
There is more documentation on the mod_auth module at the Apache web site.